Hey guys,
I'm sending custom web socket frames from server to client. I managed to get handshake seamlessly but sending regular text frames causes me problems (the message on the client side is not received). This is what I send:
unsigned char data2[6] = { 129, 4, 't', 'e', 'x', 't' };
int jj = SDLNet_TCP_Send(client_socket, data2, 6);
The data is sent correctly (handshake worked and jj has value of 6). I based my code on explanation found here http://stackoverflow.com/questions/8125507/how-can-i-send-and-receive-websocket-messages-on-the-server-side
My client is quite simple and I'm posting just for completion:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Web Socket Example</title>
<meta charset="UTF-8">
<script type="text/javascript">
var webSocket = new WebSocket("ws://localhost:48884/", "sample");
webSocket.binaryType = "arraybuffer";
webSocket.onopen = function(e) { alert("opened"); }
webSocket.onclose = function(e) { alert("closed"); }
webSocket.onerror = function(e) { alert("error"); }
webSocket.onmessage = function(e) { alert("got: " + e.data); }
</script>
</head>
<body>
<div id="holder" style="width:600px; height:300px"></div>
</body>
</html>
I get alert "opened" (as handshake succeeded) but don't get alert "got".
The web socket version I get from client is 13.
Any ideas why handshake worked and regular text doesn't?