Adding Status and Last server response handled but not tested
This commit is contained in:
@ -17,6 +17,24 @@ FDTFluxWebSocketClient::FDTFluxWebSocketClient()
|
||||
FDTFluxWebSocketClient::LastId++;
|
||||
}
|
||||
|
||||
bool FDTFluxWebSocketClient::CanSend() const
|
||||
{
|
||||
return Ws.IsValid();
|
||||
}
|
||||
|
||||
TSharedPtr<FDTFluxWebSocketClient> FDTFluxWebSocketClient::GetClient(
|
||||
const TArray<TSharedPtr<FDTFluxWebSocketClient>> InClients, const FName InName)
|
||||
{
|
||||
for(auto Client: InClients)
|
||||
{
|
||||
if(Client->ClientId == InName)
|
||||
{
|
||||
return Client;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FDTFluxWebSocketClient::Connect()
|
||||
{
|
||||
Ws = FWebSocketsModule::Get().CreateWebSocket(WsAddress);
|
||||
@ -80,7 +98,10 @@ void FDTFluxWebSocketClient::AddError(const FDTFluxWsClientError Error)
|
||||
|
||||
void FDTFluxWebSocketClient::Send(const FString& Message) const
|
||||
{
|
||||
Ws->Send(Message);
|
||||
if(Ws.IsValid())
|
||||
{
|
||||
Ws->Send(Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user