Decides if this instance of the TocketBase Class belongs to a TocketClientBase or TocketServer instance.
Definition object for the functionality of the Socket.
Access the CustomData object of this Socket.
Optional
key: KThe key of the CustomData property to fetch. If left out the entire CustomData Object is returned.
Either the content of the CustomData property or the CustomData Object
Fetch all or a subset of current connections of the Socket, optionally narrowed by a filter.
Optional
arg: ConnectionFilter<NonNullable<Connector<S>>>a Filter for the connections to be fetched. If left empty, all connections are returned.
Registers a communication preset.
identifier of this preset.
Optional
handlerName: stringname of the handler function on the target Socket this should process the messages
Optional
defaultTarget: ConnectionFilter<NonNullable<Connector<S>>>identifier of the Socket the communication should target. uses the 'main' socket by default
the generated Communication preset.
Client id generated by the server, empty in the Base and Server versions of the class
Protected
customPrivate
Readonly
typeType of the Socket, can either be "Server" or "Client"
Constructor implementation
The Socket type.
Object in which the socket can store its data.
General Properties
Protected
_launchLaunch a previously registered communication preset.
the name of the communication preset to start
Optional
content: DefBack<S, N, "content">the data used to initialize the connection.
Optional
targetFilter: ConnectionFilter<NonNullable<Connector<S>>>the identifier of the endpoint this should receive this message
Private
compileCompiles a SocketRequest object from provided data.
the message body this should be transferred to the endpoint
the name of the endpoint's handler function this should process the message
Optional
oldID: stringID of the message this is being replied to.
SocketRequest Object
Providing the communication method with smart and typed parameter functions.
Name of preset
handler name
targetName
Optional
pID: stringPID instance
The finished method handler
Protected
makeUUIDPrivate
objectCompares to objects based on their contents recursively.
A filter object
The "real" object to test against
true if the targetObject contains identical properties to the filter object, otherwise false
Modifies custom data on a Socket or Client. All connected Sockets and Clients receive the change immediately.
name of the property to set
new value of the property
Protected
connectionsProtected
presetsMap holding all communication presets registered to the Socket
Protected
promiseGenerated using TypeDoc
The base class that implements the core logic of Tocket. Since WebSockets are bidirectional most functionality is shared between clients and servers. This Class is not meant to be used directly, use any of the Client and Server classes that inherit from it.