Settings

List of available settings

TG_PUBSUB_HOST

Network interface on which the pubsub server should bind to (default: localhost).

TG_PUBSUB_PORT

Port on which the pubsub server should listen on (default: 8090).

TG_PUBSUB_PING_DELTA

Interval of periodical pings sent to clients, to disable pings set to False (default: 30).

TG_PUBSUB_EXTRA_MODELS

List of import strings to subclasses of ModelListenConfig representing extra models that should be listened on (see: Cant extend the model with ListenableModelMixin?). (default: [])

TG_PUBSUB_HELLO_PACKETS

List of import strings to callables that must return an instance of BaseMessage. These are sent to clients after successful connection has been established. (default: [])

TG_PUBSUB_PROTOCOL_HANDLER

The protocol handler for your application (default: tg_pubsub.protocol.RequestServerProtocol).

Builtin protocols:

class tg_pubsub.protocol.RequestServerProtocol[source]

WebSocketServerProtocol that gives handler a request-like object which might contain the session/user if token was provided.

class tg_pubsub.protocol.SessionRequiredServerProtocol[source]

WebSocketServerProtocol which only allows handshakes with a valid token

class tg_pubsub.protocol.AnyUserServerProtocol[source]

WebSocketServerProtocol implementation that allows any users (that provide a token)

class tg_pubsub.protocol.AnonymousUserServerProtocol[source]

WebSocketServerProtocol implementation that only allows anonymous users

class tg_pubsub.protocol.AuthenticatedUserServerProtocol[source]

WebSocketServerProtocol implementation that only allows authenticated users

class tg_pubsub.protocol.StaffUserServerProtocol[source]

WebSocketServerProtocol implementation that only allows staff users

class tg_pubsub.protocol.SuperUserServerProtocol[source]

WebSocketServerProtocol implementation that only allows superusers

Custom protocols should extend built-in protocols