Endpoint: /chatHub. The connection belongs to the browser session;
the Routing Service uses its SignalR connection ID to identify the chat.
Website methods
Method for connection.invoke |
Arguments in this order | Return value |
|---|---|---|
Register |
customerName (string), skill (string), language (string) |
boolean |
AddMessage |
message (string) |
no application-level acknowledgement |
Register triggers processing of a new chat request. skill and language
must match a configured chat flow mapping. true means that the hub method
completed without its own error. Subsequent processing can still fail.
No conversation ID is returned to the website.
Call AddMessage only for a registered chat. If no chat exists for the
connection, the server logs the error and does not process the message.
A completed invoke operation is therefore not a delivery acknowledgement.
Server events
Name for connection.on |
Arguments | Meaning |
|---|---|---|
OnStateChangedAsync |
newState |
new conversation state |
OnPositionChangedAsync |
position |
reported queue position |
AddMessageAsync |
participant, htmlMessage |
participant label and message |
Use the event names including Async. Chat sends one argument
for a state change; callback sends two.
With the normal JSON configuration, the state is a numeric ConversationState.
Common values are Inactive = 0, Waiting = 1, Alerting = 2,
Connected = 3, Disconnected = 13 and OnHold = 14; Finalized = -1.
Handle other values too, including closure and error states, rather than
displaying an unknown value as connected. The flow determines the actual sequence.
htmlMessage may contain HTML. Do not insert it using unchecked innerHTML.
The chat guide displays plain text; if formatting is required,
the website must explicitly filter permitted HTML.
Close the connection
connection.stop() closes the connection. On disconnect, the hub unregisters
the associated chat. There is no separate hub method to resume a chat with
a new connection ID. Do not silently register a second request after reconnecting.