Socket.io servers emit a "connect_error" event whenever there is a connection failure.
For example, connection middleware functions can be used to add functionality to the connection process (for authentication, logging, etc.). If a middleware function has a problem, it can fail by returning an error, in which case the connection attempt will fail.
Here is an example of a server code snippet where the middleware function fails and returns an error:
io.use((socket, next) => {
// Problem with authentication...return an error
next(new Error("ERROR_AUTHENTICATION_INVALID"));
});
The above code will cause the server to emit a "connect_error" message. In the Socket.io Javascript client, "connect_error" messages can be received as follows:
"connect_error" messages are not currently passed all the way through by the Unreal Engine client. They do, however, make it through to the underlying Socket.io protocol wrapper classes. In sio_socket.cpp, for example, these messages are received in the on_message_packet function, where they are identified as packet::type_error (see screenshot).
It would be great if the plugin could pass the "connect_error" messages through to the SocketIONative class via a new callback called "OnConnectError" or equivalent, as this would allow users of the Unreal Engine client to respond properly to connection errors.
Socket.io servers emit a "connect_error" event whenever there is a connection failure.
For example, connection middleware functions can be used to add functionality to the connection process (for authentication, logging, etc.). If a middleware function has a problem, it can fail by returning an error, in which case the connection attempt will fail.
Here is an example of a server code snippet where the middleware function fails and returns an error:
The above code will cause the server to emit a "connect_error" message. In the Socket.io Javascript client, "connect_error" messages can be received as follows:
"connect_error" messages are not currently passed all the way through by the Unreal Engine client. They do, however, make it through to the underlying Socket.io protocol wrapper classes. In sio_socket.cpp, for example, these messages are received in the on_message_packet function, where they are identified as packet::type_error (see screenshot).
It would be great if the plugin could pass the "connect_error" messages through to the SocketIONative class via a new callback called "OnConnectError" or equivalent, as this would allow users of the Unreal Engine client to respond properly to connection errors.