Skip to content

octoprint.vendor.sockjs.tornado.conn#

SockJSConnection #

Bases: object

__init__(session) #

Connection constructor.

session Associated session

broadcast(clients, message) #

Broadcast message to the one or more clients. Use this method if you want to send same message to lots of clients, as it contains several optimizations and will work fast than just having loop in your code.

clients Clients iterable message Message to send.

is_closed() property #

Check if connection was closed

on_close() #

Default on_close handler.

on_message(message) #

Default on_message handler. Must be overridden in your application

on_open(request) #

Default on_open() handler.

Override when you need to do some initialization or request validation. If you return False, connection will be rejected.

You can also throw Tornado HTTPError to close connection.

request ConnectionInfo object which contains caller IP address, query string parameters and cookies associated with this request (if any).

send(message, binary=False) #

Send message to the client.

message Message to send.

Back to top