io
autogen.io.IOWebsockets
IOWebsockets
A websocket input/output stream.
Initialize the websocket input/output stream.
Name | Description |
---|---|
websocket | Type: autogen.io.websockets.ServerConnection |
Instance Attributes
websocket
The URI of the websocket server.
Instance Methods
get_default
Get the default input/output stream.
Returns:
IOStream: The default input/output stream.
Type | Description |
---|---|
IOStream | IOStream: The default input/output stream. |
get_global_default
Get the default input/output stream.
Returns:
IOStream: The default input/output stream.
Type | Description |
---|---|
IOStream | IOStream: The default input/output stream. |
input
Read a line from the input stream.
Name | Description |
---|---|
prompt | The prompt to display. Defaults to "". Type: str Default: ” |
password | Whether to read a password. Defaults to False. Type: bool Default: False |
Type | Description |
---|---|
str | str: The line read from the input stream. |
Print data to the output stream.
Name | Description |
---|---|
*objects | Type: Any |
sep | The separator between objects. Defaults to ” ”. Type: str Default: ’ ‘ |
end | The end of the output. Defaults to “ Type: str Default: ‘\n’ |
flush | Whether to flush the output. Defaults to False. Type: bool Default: False |
run_server_in_thread
Factory function to create a websocket input/output stream.
Name | Description |
---|---|
host | The host to bind the server to. Defaults to “127.0.0.1”. Type: str Default: ‘127.0.0.1’ |
port | The port to bind the server to. Defaults to 8765. Type: int Default: 8765 |
on_connect | The function to be executed on client connection. Typically creates agents and initiate chat. Type: Callable[[ForwardRef(‘IOWebsockets’)], None] |
ssl_context | The SSL context to use for secure connections. Defaults to None. Type: ssl.SSLContext | None Default: None |
**kwargs | Type: Any |
send
Send a message to the output stream.
Name | Description |
---|---|
message | The message to send. Type: BaseEvent |
set_default
Set the default input/output stream.
Name | Description |
---|---|
stream | The input/output stream to set as the default. Type: ForwardRef(‘IOStream’) | None |
set_global_default
Set the default input/output stream.
Name | Description |
---|---|
stream | The input/output stream to set as the default. Type: IOStream |