diff --git a/SocketIOClient.uplugin b/SocketIOClient.uplugin index 60036a9..5875bd5 100644 --- a/SocketIOClient.uplugin +++ b/SocketIOClient.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, "Version": 1, - "VersionName": "2.5.7", + "VersionName": "2.5.8", "EngineVersion": "5.1", "FriendlyName": "Socket.IO Client", "Description": "Real-time WebSocket networking via Socket.IO protocol usable from blueprints and c++.", diff --git a/Source/SIOJson/Private/SIOJsonObject.cpp b/Source/SIOJson/Private/SIOJsonObject.cpp index 2f2168a..0a7dc82 100644 --- a/Source/SIOJson/Private/SIOJsonObject.cpp +++ b/Source/SIOJson/Private/SIOJsonObject.cpp @@ -345,12 +345,19 @@ void USIOJsonObject::SetObjectField(const FString& FieldName, USIOJsonObject* Js void USIOJsonObject::GetBinaryField(const FString& FieldName, TArray& OutBinary) const { + if (!JsonObj->HasTypedField(FieldName)) { UE_LOG(LogSIOJ, Warning, TEXT("No field with name %s of type String"), *FieldName); } TSharedPtr JsonValue = JsonObj->TryGetField(FieldName); + if (!JsonValue) + { + UE_LOG(LogSIOJ, Warning, TEXT("JsonValue is null for %s, aborting parse."), *FieldName); + return; + } + if (FJsonValueBinary::IsBinary(JsonValue)) { OutBinary = FJsonValueBinary::AsBinary(JsonValue); diff --git a/Source/SocketIOLib/Private/internal/sio_packet.cpp b/Source/SocketIOLib/Private/internal/sio_packet.cpp index 22a41bb..bf6e085 100644 --- a/Source/SocketIOLib/Private/internal/sio_packet.cpp +++ b/Source/SocketIOLib/Private/internal/sio_packet.cpp @@ -504,15 +504,14 @@ namespace sio break; } } - else if (packet::is_binary_message(payload) || (m_partial_packet && !isdigit(payload[0]))) + + //In current socket.io version, it doesn't appear binary payloads come with a frame message. + else if (m_partial_packet && payload.size() > 0) { - if (m_partial_packet) + if (!m_partial_packet->parse_buffer(payload)) { - if (!m_partial_packet->parse_buffer(payload)) - { - p = std::move(m_partial_packet); - break; - } + p = std::move(m_partial_packet); + break; } } else