Open aroman opened 3 years ago
how about this library? @aroman https://github.com/psygame/UnityWebSocket
Thanks for sharing your library! Actually I ended up only needing binary messages, but if I end up needing this feature I will look more closely into it.
Yes, this would be important to seperate data from commands.
Currently, the API only has
OnMessage(byte[] bytes)
, but this doesn't allow us to determine if the message was encoded as binary or text. This data is known to the library viaWebSocketMessageType
, so I suggest this be exposed to clients as well.Some options:
OnMessage(byte[] bytes, WebSocketMessageType messageType
)OnMessageText(string data)
andOnMessageBinary(byte[] bytes)
.I'd be happy to submit a PR implementing either approach, let me know what you think!
Thanks again for this great library.