I'm trying to connect to the socket.io server that is using parser. The following code connects well to server.
export const connect_push_socket = createAction(CONNECT_SOCKET, () => {
const socket = io.connect(process.env.NEXT_PUBLIC_WEBSOCKET_URL, {
reconnection: false,
withCredentials: true,
parser: socketIoMsgpackParser
});
return {
socket: socket
}
});
But when I try to implement that in C++, the connection is immediately lost.
sio::client h;
connection_listener l(h);
h.set_open_listener(std::bind(&connection_listener::on_connected, &l));
h.set_close_listener(std::bind(&connection_listener::on_close, &l,std::placeholders::_1));
h.set_fail_listener(std::bind(&connection_listener::on_fail, &l));
h.connect("wss://gateway.abc.com");
_lock.lock();
if (!connect_finish)
{
cout << "wait\n";
_cond.wait(_lock);
}
_lock.unlock();
current_socket = h.socket();
h.sync_close();
h.clear_con_listeners();
error code :
[2022-09-28 23:02:26] [devel] endpoint constructor
[2022-09-28 23:02:26] [devel] client constructor
wait
[2022-09-28 23:02:26] [connect] Successful connection
[2022-09-28 23:02:26] [connect] WebSocket Connection 111.67.154.150:443 v-2 "WebSocket++/0.8.2" /socket.io/?EIO=4&transport=websocket&t=1664373746 101
Connected.
encoded payload length:2
Close by reason:End by user
[2022-09-28 23:02:26] [warning] got non-close frame while closing
[2022-09-28 23:02:27] [error] handle_read_frame error: asio.ssl.stream:1 (stream truncated)
[2022-09-28 23:02:27] [info] asio async_shutdown error: asio.ssl.stream:1 (stream truncated)
[2022-09-28 23:02:27] [devel] handle_terminate error: asio.ssl.stream:1 (stream truncated)
Client Disconnected.
clear timers
sio closed
Aucun commentaire:
Enregistrer un commentaire