Houdini 20.5 hwebserver

hwebserver.webSocket function

Decorator for registering WebSocket classes with Houdini’s web server.

webSocket(path, is_prefix=False, ports=[])

Note

WebSocket support is Python3 only.

When you decorate a class with this decorator, it registers the class with the webserver on the given path.

path

A string starting with "/", but which may or may not end with a slash. When registering paths, trailing slashes do not affect the behavior of the server; if path does not have a slash it is implicitly added, and when the server matches paths to request handlers, any paths sent in server requests have a path added to them if it is missing.

is_prefix

If False, the class will only be created when the requested path matches path. If True, however, the class will be created when the requested path starts with path, followed by a slash, followed by anything else.

ports

Any ports the websocket class can be created on. If no ports are specified the class is bound to the main port of the webserver. The port name can be any name that is not empty and is not main (reserved for the main port).

See also

hwebserver

Classes

Starting and Stopping

Handling Web Requests and Returning Responses

WebSocket

  • WebSocket

    Base class for WebSocket support with the embedded server.

  • hwebserver.webSocket

    Decorator for registering WebSocket classes with Houdini’s web server.

API Calls

  • hwebserver.apiFunction

    Decorator for functions that can be called through an API endpoint on Houdini’s web server, returning JSON or binary responses.

  • hwebserver.APIError

    Raise this exception in apiFunction handlers to indicate an error.