Houdini 19.0 hwebserver

hwebserver.registerOpdefPath function

Tells Houdini’s web server to use the specified prefix as a handler to serve opdef requests.

registerOpdefPath("/opdef", port=-1)

When the server receives a request whose path starts with prefix, the server will respond with the corresponding opdef section data. The port can be optionally specified if the handler should run off a port other than the main server port.

Call this function before you call hwebserver.run, not from a URL handler.

For example, if you do this:

hwebserver.registerOpdefPath("/opdef")

…and the client requests this server path:

/opdef/obj/geo?Help

…then the server will automatically serve the section Help from the geo node.

Note

If a URL handler has a URL more specific (matches more path parts) than the opdef path prefix, the server will use the handler instead of opdef lookup.

For example, even if you registered the opdef from above, if the client requested /opdef/geo/foo.bgeo and you have a dynamic handler for /opdef/geo, the server would use the handler instead of using the opdef handler.

This might be useful if you need a few dynamically generated opdef handlers mixed in with the static opdef handler. However, it’s usually best to avoid the confusion and keep opdef resources separate from dynamic resources, such as by using the default /opdef prefix for opdef section requests.

See also

hwebserver

クラス

開始と停止

ウェブリクエストの処理とレスポンスの返し

ウェブソケット

  • WebSocket

    Base class for WebSocket support with the embedded server.

  • hwebserver.webSocket

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

APIコール

  • 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.