WebSocket API
WebSocket Overview
SymetryML supports the use of WebSocket technology on a subset of its API. This API can be used when lower latency is needed. Each WebSocket call contains a set of 3 pieces of information:
The header length
The headers, which are used to authenticate the request.
The message payload.
The message are string formatted using the following protocol
<Header-length>,<header><payload>
ex:65,{headers=['some date','some md5','some authorization','some customer id'],extraKeys={}}{PAYLOAD}
The following table describes this information.
Header Length
Length of the header section.
Header
A JSON string containing 2 pieces of information - header[4] = an array of 4 string used for authorization.
- date
- md5
- authorization hash code.
- customer id
- extraKeys = contains extra information that depends on the WebSocket endpoint invoked. This Header field is mandatory on the first WebSocket message only.
WebSocket Payload
About WebSocket Authorization
With WebSocket, the following string must be used to create the Authorization hash code.
Item
Description
Authorization
Signature
Signature
Base64( HMAC-SHA2(UTF-8-Encoding-Of( StringToSign ) ) );
StringToSign
Content-MD5 + "\n" SymetryML-Secret-Key + "\n" Sym-Date Header + "\n" SymetryML-key-Id + "\n" RequestBody + "\n" ServicePath + "\n" extraKeys
Sym-Date format
ServicePath
Path of the URL to be invoked (for instance /symetry/ws/predict).
extraKeys
Each extra key should be included individually on a separate new line. See example below for details.
Example of WebSocket String to Sign
Learning Using WebSocket
This API function call allows users to learn a dataframe using WebSocket services.
URL
Extra Parameter
Index
Short Description
Description
0
SymetryML Project ID
The name of the project to learn the data.
WS Response
HTTP Status Code
HTTP Status Message
Description
200
OK
Success.
Sample WS Request
Forgetting Using WebSocket
URL
Extra Parameter
Index
Short Description
Description
0
SymetryML Project ID
The name of the project to learn the data.
WS Response
HTTP Status Code
HTTP Status Message
Description
200
OK
Success.
Predicting Using WebSocket
This API function call allows users to predict using WebSocket services.
URL
Extra Parameter
Index
Short Description
Description
0
SymetryML Project ID
The name of the project to learn the data.
1
Model Id
The model name to use to make predictions.
WS Response
Sample WS Request
Last updated