Connect to the Krmx server.
For the serverUrl parameter you have to provide the ws://
or wss://
url of the websocket endpoint where your Krmx server is
running. For example: ws://my-subdomain.example.org:3002/my-game
or ws://localhost:1234
.
Connect to the Krmx server.
For the serverUrl parameter you have to provide the ws://
or wss://
url of the websocket endpoint where your Krmx server is
running. For example: ws://my-subdomain.example.org:3002/my-game
or ws://localhost:1234
.
Disconnect from the Krmx server. This only works when the client is connected but not yet linked. If force is passed, this will even disconnect when the client is linked to a user.
Example: await client.unlink(); await client.disconnect();
or await client.disconnect(true);
Disconnect from the Krmx server. This only works when the client is connected but not yet linked. If force is passed, this will even disconnect when the client is linked to a user.
Example: await client.unlink(); await client.disconnect();
or await client.disconnect(true);
Optional
force: booleanReturns the current status of the Krmx client.
Returns the username of the user to which the client is linked on the Krmx server.
Returns the username of the user to which the client is linked on the Krmx server.
Returns the available information of the users on the Krmx server.
Returns the available information of the users on the Krmx server.
Sends a message to the Krmx server with an intent to leave. The Krmx server will gracefully disconnect the client and inform all other connected clients that the client intended to disconnect.
Sends a message to the Krmx server with an intent to leave. The Krmx server will gracefully disconnect the client and inform all other connected clients that the client intended to disconnect.
Link the connection to a user.
The username of the user you want to link to. For example: 'simon'.
An optional auth string. This value is sent to the Krmx server and will be available in the on('authenticate', ...)
listener.
Error Throws an error, if the client is not connected or the client is already linked to a user.
Link the connection to a user.
The username of the user you want to link to. For example: 'simon'.
Optional
auth: stringAn optional auth string. This value is sent to the Krmx server and will be available in the on('authenticate', ...)
listener.
Error Throws an error, if the client is not connected or the client is already linked to a user.
Send a message to the Krmx server.
Error Throws an error, if the client is not connected or the client is not linked to a user.
Unlink the connection from its user.
Error Throws an error, if the client is not connected or the client is not linked to a user.
Unlink the connection from its user.
Error Throws an error, if the client is not connected or the client is not linked to a user.
The client type describes the fields and methods that are accessible by using the createClient method.