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
ping
command (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
server
pid of the streaming socket process,caller
pid of the caller awaiting for the result,message
struct with call context, seeXtbClient.StreamingMessage
.
Result of the query will be delivered to message mailbox of the caller
process.