Constructor
new Client(ws)
create a web socket client
Parameters:
Name | Type | Description |
---|---|---|
ws |
ws | Web socket object |
Properties:
Name | Type | Description |
---|---|---|
serialPorts |
Array.<SerialPort> | list of subscribed |
serialPortsList |
Array.<string> | list of string names of subscribed |
- Source:
Methods
close()
close client connection. Set serialPorts and serialPortsList array to null.
- Source:
echo()
echo received message back to web client
- Source:
list()
list all available serial ports and send it to the client
- Source:
openSerial(port)
add opened SerialPort object and its name
Parameters:
Name | Type | Description |
---|---|---|
port |
SerialPort | SerialPort object opened by client |
- Source:
sendit(toSend)
send data via websocket to the client
Parameters:
Name | Type | Description |
---|---|---|
toSend |
Object | JSON object received to be sent. Contains message method and data. |
- Source:
write(msg)
write received data to subscribed serial ports.
Parameters:
Name | Type | Description |
---|---|---|
msg |
String | received string data from client |
- Source:
Events
message
Parameters:
Name | Type | Description |
---|---|---|
inmessage |
Object | Type of message emitted from |
- Source: