Skip to main content

Crate wabot_addon_chat_controller_socket

Crate wabot_addon_chat_controller_socket 

Source
Expand description

Socket.IO chat channel — port of wabot-ts addon/chat-controller/socket/SocketChannel.ts. Built on socketioxide.

Runs its own axum server on a configurable bind address (sharing with the REST router is a future enhancement — would let one process expose REST + WebSocket on the same port). Listens on the configured namespace for "message" events whose payload matches SocketIncoming; each message becomes a ChannelMessage and is forwarded to the chat-controller framework. Replies emit "message" back to the originating socket.

§Configuration

Register a SocketChannelConfig singleton before register_singletons!(&c, SocketChannel):

ⓘ
c.register_instance::<SocketChannelConfig>(Arc::new(
    SocketChannelConfig::new("/chat", "0.0.0.0:3001"),
));
register_singletons!(&c, SocketChannel);

Structs§

SocketChannel
Socket.IO chat channel. Cheap to clone (Arc-internal); construct once per process and register as a singleton.
SocketChannelConfig
Bind address + namespace + CORS for the socket.io server.
SocketFile
File attachment payload over socket.io.
SocketIncoming
Inbound message shape — matches SocketChannelReceivedMessage from the TS addon. All except chat_id is optional.

Constants§

SOCKET_CHANNEL_NAME