Constructor
new ServerNetwork(store)
Constructor
Parameters:
Name | Type | Description |
---|---|---|
store |
Collection | Session storage |
- Source:
Fires:
- ServerNetwork#event:UDP-Req
- ServerNetwork#event:UDP-Res
- ServerNetwork#event:TCP-Req
- ServerNetwork#event:TCP-Res
- ServerNetwork#event:handshake-Req
Members
handshake :net.Socket
The handshake TCP server.
Type:
- net.Socket
- Source:
store
- Source:
TCP :net.Socket
The TCP Q4S socket.
Type:
- net.Socket
- Source:
UDP :dgram.Socket
The UDP Q4S socket.
Type:
- dgram.Socket
- Source:
Methods
close()
Close all the sockets.
- Source:
listen(HandshakePort, TCPPort, UDPPort)
Async method to create the handshake socket. After completition the
sendHandshakeTCP method can be called to send messages. After completition
the class starts to emit events.
Parameters:
Name | Type | Description |
---|---|---|
HandshakePort |
Number | The string containing the ip to connect |
TCPPort |
Number | Port to connect |
UDPPort |
Number | Origin port for the handshake connection. |
- Source:
sendTCP(message, sessionId)
Send an TCP message
Parameters:
Name | Type | Description |
---|---|---|
message |
String | |
sessionId |
Number |
- Source:
sendUDP(message, sessionId)
Send an udp message with session Id.
Parameters:
Name | Type | Description |
---|---|---|
message |
String | |
sessionId |
Number |
- Source: