View Source XtbClient.StreamingSocket (XtbClient v0.1.1)
WebSocket server used for asynchronous communication.
StreamingSocket is being used like standard GenServer - could be started with start_link/1 and supervised.
After successful connection to WebSocket the flow is:
- process schedules to itself the
pingcommand (with recurring interval) - to maintain persistent connection with backend.
Link to this section Summary
Functions
Starts a XtbClient.StreamingSocket process linked to the calling process.
Subscribes pid process for messages from method query.
Link to this section Types
Link to this section Functions
@spec start_link(%{ :stream_session_id => binary(), :type => XtbClient.AccountType.t(), :url => binary() | URI.t(), optional(any()) => any() }) :: GenServer.on_start()
Starts a XtbClient.StreamingSocket process linked to the calling process.
@spec subscribe(client(), client(), XtbClient.StreamingMessage.t()) :: :ok
Subscribes pid process for messages from method query.
arguments
Arguments
serverpid of the streaming socket process,callerpid of the caller awaiting for the result,messagestruct with call context, seeXtbClient.StreamingMessage.
Result of the query will be delivered to message mailbox of the caller process.