-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
The current RegisterStreamingHandlers is not ideal when it comes to implement a streaming service:
- every new client message calls the endpoint again
- the endpoint cannot return an error once the streaming started
- the contract between onet and the endpoint is not clear
A first, simplified method signature for a blocking endpoint:
Endpoint(<-input, ->output) error
- arguments:
- input-channel of messages from client
- output-channel of messages from endpoint
- return:
- error, which can be
nilto indicate the endpoint finished its work and is done
- error, which can be
Onet would do the following:
- setup the input- and output-channel
- call the endpoint for each new connection from a client using
Client.Stream- the endpoint is blocking and listening on the input channel for new messages, and sending messages on the output channel
- if the endpoint is done, it can return with a
nilerror to indicate successful termination - any non-
nilerror indicates an error by the endpoint
- send every message from the client through the input channel to the endpoint
- send every message from the output-channel of the endpoint to the client
- close the input-channel if the websocket is closed by the client
- all further messages in the output-channel are ignored
- any returned error from the endpoint is ignored
- who should close the output-channel?
- close the connection if the endpoint returns
- if the error is
nil, the connection is closed without an error - if the error is not
nil, the error is sent as the reason for closing the connection
- if the error is
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels