πAuthorization
To authenticate yourself when connecting to the Flow WebSocket server, send an initial JSON message with the following format:
{
"type": "auth",
"data": {
"app": "<app name>",
"key": "<user UUID>"
}
};Parameter
Type
Required
Description
Examples
const authMessage = {
type: 'auth',
data: {
app: "<app name>",
key: "<user UUID>",
}
};
ws.send(JSON.stringify(authMessage));import (
"encoding/json"
"log"
)
type authMessage struct {
Type string `json:"type"`
Data struct {
App string `json:"app"`
Key string `json:"key"`
} `json:"data"`
}
authMsg := authMessage{
Type: "auth",
Data: struct {
App string `json:"app"`
Key string `json:"key"`
}{
App: "<app name>",
Key: "<user UUID>",
},
}
jsonMessage, err := json.Marshal(authMsg)
if err != nil {
log.Println("Failed to marshal auth message:", err)
return
}
err = ws.WriteMessage(websocket.TextMessage, jsonMessage)
if err != nil {
log.Println("Failed to send auth message:", err)
}
Responses
Type
Last updated