Creates an instance of RPCServer
.
Optional
port: numberThe port number to listen on. If not provided, the server will operate in noServer mode.
Protected
callsProtected
clientsProtected
currentIDProtected
eventsProtected
functionsProtected
groupProtected
groupsProtected
pingProtected
socketProtected
usersProtected
wssThe WebSocket server instance.
Protected
callRPCCloses the WebSocket server.
Protected
createProtected
deleteEmits an event to all members of a group.
The name of the group.
The name of the RPC method.
The parameters to be passed to the RPC method.
Returns the number of members in a group.
The name of the group.
The number of members in the group.
Forwards the upgrade request to the WebSocket server. Useful if you have an existing HTTP server and want to handle WebSocket upgrades.
Iterates over all members of a group and calls a callback function for each member.
The name of the group.
The callback function to be called for each member.
Registers an event listener.
The name of the event.
The function to be called when the event is emitted.
A SignalConnection
object.
Protected
onProtected
onRegisters a callback to be called when a group is removed.
The name of the group.
The callback function to be called when the group is removed.
Protected
onProtected
onProtected
onRPCEventProtected
onRPCMessageProtected
onRPCResponseRegisters a listener for changes in the user's connection status.
The username to monitor for connection status changes.
A callback function that is invoked when the user's connection status changes. The callback receives a boolean parameter indicating whether the user is connected (true) or disconnected (false).
A function that can be called to remove the listener.
Protected
pingHelper to register an authorized RPC function that requires user authentication.
The name of the RPC function.
The function to be registered.
Registers an RPC function.
The name of the RPC function.
The function to be registered.
Protected
RegisterRegisters a JWT authentication function.
A function that takes a JWT token and returns a UserInfo
object or undefined
.
Protected
sendProtected
sendProtected
send
The
RPCServer
class extendsRPCBase
and implementsGroupEmitter
to provide a WebSocket-based RPC server with group management and JWT authentication support.Template: WebSocket
The WebSocket type used by the server.