I've had the same problem, turned out to be lifetime of one of the callbacks struct parameter.
Make sure your wiced_websocket_callbacks_t argument to wiced_websocket_connect or wiced_websocket_secure_connect is not allocated on the stack, the library does not take a copy and expects it to have lifetime at least the duration of the websocket connection. I fixed it by creating a static object for this.
You may also find this thread helpful. It took me some hacks and fixes to make it work. Broadcom says that this library is not supported yet (?) in 3.1.2.
Thank you Alex for your quick response!
Let me look at that thread.
May get back to you if any question.
Hopefully the new SDK release is coming soon.
Now I guess I know what happened.
wiced_tcp_register_callbacks( &websocket->socket, websocket->callbacks->on_open, NULL, websocket->callbacks->on_close ) in wiced_websocket_connet() gives a NULL for on_message...
wiced_tcp_register_callbacks() checks if the input callbacks are NULL though. internal_async_socket_callback() who actually calls the callbacks does not check if the callbacks are NULL or not. The NULL check in wiced_tcp_register_callbacks() is actually useless as it doesn't prevent internal_async_socket_callback() to call the NULL function anyway. The workaround would be whenever you call wiced_tcp_register_callbacks() you have to make sure that all three callback functions non-NULL as argument. If you really don't want to register one of the three callbacks, you have to implement it with an empty body and pass it to wiced_tcp_register_callbacks().
Note there is a dup wiced_tcp_register_callbacks() in wiced_websocket_connect() after handshake. Basically you can combine this the two wiced_tcp_register_callbacks() together.