View Source XtbClient.MainSocket (XtbClient v0.1.1)
WebSocket server used for synchronous communication.
MainSocket
is being used like standard GenServer
- could be started with start_link/1
and supervised.
After successful connection to WebSocket the flow is:
- process casts
login
command to obtain session with backend server, - process schedules to itself the
ping
command (with recurring interval) - to maintain persistent connection with backend.
Link to this section Summary
Functions
Casts query to get data from the backend server.
Starts a XtbClient.MainSocket
process linked to the calling process.
Casts query to get streaming session ID.
Link to this section Types
Link to this section Functions
Casts query to get data from the backend server.
Might be also used to send command to the backend server.
arguments
Arguments
server
pid of the main socket process,caller
pid of the caller awaiting for the result,ref
unique reference of the query,method
name of the query method,params
[optional] arguments of themethod
.
Result of the query will be delivered to message mailbox of the caller
process.
@spec start_link(%{ :app_name => binary(), :password => binary(), :type => XtbClient.AccountType.t(), :url => binary() | URI.t(), :user => binary(), optional(any()) => any() }) :: GenServer.on_start()
Starts a XtbClient.MainSocket
process linked to the calling process.
Casts query to get streaming session ID.
arguments
Arguments
server
pid of the main socket process,caller
pid of the caller awaiting for the result.
Result of the query will be delivered to message mailbox of the caller
process.