IOWebsockets

IOWebsockets(websocket: autogen.io.websockets.ServerConnection)

A websocket input/output stream.

Initialize the websocket input/output stream.

Parameters:
NameDescription
websocketThe websocket server.

Type: autogen.io.websockets.ServerConnection

Static Methods

run_server_in_thread

run_server_in_thread(
    *,
    host: str = '127.0.0.1',
    port: int = 8765,
    on_connect: Callable[[ForwardRef('IOWebsockets')], None],
    ssl_context: ssl.SSLContext | None = None,
    **kwargs: Any
) -> Iterator[str]

Factory function to create a websocket input/output stream.

Parameters:
NameDescription
hostThe host to bind the server to.

Defaults to “127.0.0.1”.

Type: str

Default: ‘127.0.0.1’
portThe port to bind the server to.

Defaults to 8765.

Type: int

Default: 8765
on_connectThe function to be executed on client connection.

Typically creates agents and initiate chat.

Type: Callable[[ForwardRef('IOWebsockets')], None]
ssl_contextThe SSL context to use for secure connections.

Defaults to None.

Type: ssl.SSLContext | None

Default: None
**kwargsType: Any

Instance Attributes

websocket


The URI of the websocket server.

Instance Methods

send

send(self, message: autogen.messages.base_message.BaseMessage) -> None

Send a message to the output stream.

Parameters:
NameDescription
messageThe message to send.

Type: autogen.messages.base_message.BaseMessage