notice

This is documentation for Rasa Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).

Version: 2.x

rasa.core.channels.socketio

SocketBlueprint Objects

class SocketBlueprint(Blueprint)

__init__

| __init__(sio: AsyncServer, socketio_path: Text, *args: Any, **kwargs: Any) -> None

Creates a :class:sanic.Blueprint for routing socketio connections.

Arguments:

  • sio: Instance of :class:socketio.AsyncServer class
  • socketio_path: string indicating the route to accept requests on.

register

| register(app: Sanic, options: Dict[Text, Any]) -> None

Attach the Socket.IO webserver to the given Sanic instance.

Arguments:

blueprint into the app.
  • app: Instance of :class:sanic.app.Sanic class
  • options: Options to be used while registering the

SocketIOOutput Objects

class SocketIOOutput(OutputChannel)

send_text_message

| async send_text_message(recipient_id: Text, text: Text, **kwargs: Any) -> None

Send a message through this channel.

send_image_url

| async send_image_url(recipient_id: Text, image: Text, **kwargs: Any) -> None

Sends an image to the output

send_text_with_buttons

| async send_text_with_buttons(recipient_id: Text, text: Text, buttons: List[Dict[Text, Any]], **kwargs: Any, ,) -> None

Sends buttons to the output.

send_elements

| async send_elements(recipient_id: Text, elements: Iterable[Dict[Text, Any]], **kwargs: Any) -> None

Sends elements to the output.

send_custom_json

| async send_custom_json(recipient_id: Text, json_message: Dict[Text, Any], **kwargs: Any) -> None

Sends custom json to the output

send_attachment

| async send_attachment(recipient_id: Text, attachment: Dict[Text, Any], **kwargs: Any) -> None

Sends an attachment to the user.

SocketIOInput Objects

class SocketIOInput(InputChannel)

A socket.io input channel.

__init__

| __init__(user_message_evt: Text = "user_uttered", bot_message_evt: Text = "bot_uttered", namespace: Optional[Text] = None, session_persistence: bool = False, socketio_path: Optional[Text] = "/socket.io", jwt_key: Optional[Text] = None, jwt_method: Optional[Text] = "HS256")

Creates a SocketIOInput object.

get_output_channel

| get_output_channel() -> Optional["OutputChannel"]

Creates socket.io output channel object.