Proxy.Handler
Handlers for normal objects.
class type ['a, 'v, 'role] t = object ... end
An ('a, 'v, 'role) t
handles incoming messages for an object of type 'a
.
attach proxy t
sets t
as the handler for proxy
.
Any method argument that corresponds to a new object will arrive as a half-initialsed proxy (created by the generated bindings using accept_new
). This function must be called immediately (before switching threads or using the proxy) so that any future events addressed to this object can be handled.
If the version rules turn out to be too restrictive, this can be used to disable them. Using this incorrectly may lead to a protocol error (such as receiving an event for which no handler was registered).
val accept_new :
(_, 'v, [< `Client | `Server ] as 'role) proxy ->
(module Metadata.S with type t = 'a) ->
int32 ->
('a, 'v, 'role) proxy
accept_new parent id
registers a new object, with an ID allocated by the peer.
The generated bindings call this when receiving a new object, before passsing the resulting half-initialised proxy to the application code.