Members
FileType
Possible file types the browser can request.
- Source:
ServerCommandID
An enumaration containing some command / message IDs of browser and server messages which
have to be processed by the module itself (e. g. the "Close" command).
- Source:
Methods
fromByteArray(data)
Creates a DataContainer instance from a byte array.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Uint8Array | The message's raw data as a byte array. |
- Source:
fromJSON(strJSON)
Creates a DataContainer instance from a JSON string.
Parameters:
| Name | Type | Description |
|---|---|---|
strJSON |
String | The message as a JSON string. |
- Source:
handleClientMessage(dataContainer, socket)
Handles messages coming from the client / browser.
For now essentially just forwards the messages to the service.
Parameters:
| Name | Type | Description |
|---|---|---|
dataContainer |
DataContainer.DataContainer | A message coming from the client / browser. |
socket |
net.Socket | The TCP socket connection to the service / server. |
- Source:
handleServerMessage(serverMessage, ws)
Handles messages coming from the service / server.
Parameters:
| Name | Type | Description |
|---|---|---|
serverMessage |
DataContainer.DataContainer | A message coming from the service / server. |
ws |
WebSocket | The WebSocket connection. |
- Source:
prepareFileData(dataContainer)
Converts base64 data in an OpenFile command already containing file data to binary data.
Parameters:
| Name | Type | Description |
|---|---|---|
dataContainer |
DataContainer.DataContainer |
- Source:
sendMessage(dataContainer, socket)
Sends a message to the service as binary data with an added 32 bit length value
in front.
Parameters:
| Name | Type | Description |
|---|---|---|
dataContainer |
DataContainer.DataContainer | A message. |
socket |
net.Socket | The TCP socket connection to the service / server. |
- Source:
splitMessageData(data, remaining) → {Array.<ServerMessageData>}
Splits the incoming binary data buffer coming from the service into multiple buffers,
each representing a message or part of a message.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Uint8Array | The data buffer. |
remaining |
Number | The remaining bytes of an incomplete previous message. |
- Source:
Returns:
The data split up into multiple messages or null in case
of an error.
- Type
- Array.<ServerMessageData>
Type Definitions
WebSocketServerConfig
The WebSocket server configuration object.
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
serviceAddress |
string |
<optional> |
The service address. Default: "localhost". |
servicePort |
number |
<optional> |
The service port. Default: 4281. |
wsPath |
string |
<optional> |
The WebSocket path. Default: "/TXWebSocket". |
- Source: