ensoft/entrance/1.0.4

NOTE: the latest version is 1.0.5

EnTrance.Feature.Misc

This module contains a grab-bag of type-safe wrappers around bits of EnTrance functionality that don't obviously fit somewhere better.

Raising errors

It's possible to raise a global error (as caught by the errorSub subscription) from anywhere. This can be a convenient way to correctly handle rare failure cases without lots of manual plumbing. If you want to do this, then declare a port once in your application like this:

port raiseError : String -> Cmd msg

Server-level interactions

It's possible to request the server to restart itself, in some circumstances:

  • it's running in a harness where exiting with the right code causes a re-spawn by a supervisor function

  • it's configured to permit this (via the allow_restart_requests configuration option - see cfg_core.py).

Obviously this affects all clients, not just the one making the request, so use with caution.

Send a request to the server, that elicits a response with notification type "pong". This can be used with either RPC or simple async semantics.

In practice this is of limited usefulness, since the server can be alive and connected. In most cases it's best to use the channelIsUp notifications (indicating basic websocket connectivity state) for major UI liveness indications (eg disabling all buttons) and then use RpcData state to indicate if a particular feature is being slow.

decodePong : msg -> Decoder msg

Decode a pong notification