The connection establishes fine, I can send text messages back and forth without a problem. However, whenever a ping/pong message comes through the connection goes haywire.
[91330] Starting Websocket Client Task on Socket 2
[93177] Message Received OpCode: 1 Message: asdf
[93437] Message Received OpCode: 1 Message: asdf
[94277] Message Received OpCode: 1 Message: ping
Sending Ping ... (NOTE: The following is just "asdf" being received from the client)
[95567] Message Received OpCode: 13 Message: ▒▒▒▒▒t
[96416] Message Received OpCode: 0 Message: 0j▒0▒▒fT▒
[96856] Message Received OpCode: 0 Message:
[97306] Message Received OpCode: 0 Message: 0j4▒xU▒t
After the ping/pong all further communication is just corrupted from the server view. Having fiddler on the client, it shows correct websocket communication to the server.
Here is what my RTOS While Loop Looks like;
while(nopoll_conn_is_ok(conn)) {
vTaskDelay(1);
if(!nopoll_conn_wait_until_connection_ready(conn, 0)) continue;
if(nopoll_conn_complete_pending_write(conn) != 0) continue;
msg = nopoll_conn_get_msg(conn);
if(msg) {
const char * content = (const char *) nopoll_msg_get_payload(msg);
printf("[%d] Message Received OpCode: %d Message: %s\n", system_get_time()/1000, nopoll_msg_opcode(msg), content);
if(nopoll_msg_opcode(msg) == 1) {
if(nopoll_cmp(content, "ping")) { printf("Sending Ping ...\n"); nopoll_conn_send_ping(conn);
} else {
nopoll_conn_send_text(conn, nopoll_msg_get_payload(msg), nopoll_msg_get_payload_size(msg));
}
if(msg) nopoll_msg_unref(msg);
}
}