• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# lws minimal secure streams binance
2
3This is a Secure Streams version of minimal-ws-client-binance.
4
5"policy.json" contains all the information about endpoints, protocols and
6connection validation, tagged by streamtype name.
7
8The example tries to load it from the cwd, it lives in
9./minimal-examples/secure-streams/minimal-secure-streams-binance dir, so
10either run it from there, or copy the policy.json to your cwd.  It's also
11possible to put the policy json in the code as a string and pass that at
12context creation time.
13
14The secure stream object represents a nailed-up connection that outlives any
15single socket connection, and can manage reconnections / retries according to
16the policy to keep the connection nailed up automatically.
17
18Secure Streams provides the same simplified communication api without any
19protocol dependencies.
20
21## build
22
23Lws must have been built with `LWS_ROLE_WS=1`, `LWS_WITH_SECURE_STREAMS=1`, and
24`LWS_WITHOUT_EXTENSIONS=0`
25
26```
27 $ cmake . && make
28```
29
30## Commandline Options
31
32Option|Meaning
33---|---
34-d|Set logging verbosity
35
36## usage
37
38```
39$ ./bin/lws-minimal-ws-client-binance
40[2021/08/15 06:42:40:8409] U: LWS minimal Secure Streams binance client
41[2021/08/15 06:42:40:8410] N: LWS: 4.2.99-v4.2.0-156-g8f352f65e8, NET CLI SRV H1 H2 WS SS-JSON-POL SSPROX ConMon FLTINJ IPV6-on
42[2021/08/15 06:42:40:8410] N:  ++ [495958|wsi|0|pipe] (1)
43[2021/08/15 06:42:40:8411] N:  ++ [495958|vh|0|netlink] (1)
44[2021/08/15 06:42:40:8433] N:  ++ [495958|vh|1|digicert||-1] (2)
45[2021/08/15 06:42:40:8471] N:  ++ [495958|wsiSScli|0|binance] (1)
46[2021/08/15 06:42:40:8471] N: [495958|wsiSScli|0|binance]: lws_ss_check_next_state_ss: (unset) -> LWSSSCS_CREATING
47[2021/08/15 06:42:40:8472] N: [495958|wsiSScli|0|binance]: lws_ss_check_next_state_ss: LWSSSCS_CREATING -> LWSSSCS_CONNECTING
48[2021/08/15 06:42:40:8472] N:  ++ [495958|wsicli|0|WS/h1/fstream.binance.com/([495958|wsiSScli|0|binance])] (1)
49[2021/08/15 06:42:41:8802] N: [495958|wsiSScli|0|binance]: lws_ss_check_next_state_ss: LWSSSCS_CONNECTING -> LWSSSCS_CONNECTED
50[2021/08/15 06:42:42:8803] N: sul_hz_cb: price: min: 4669185¢, max: 4672159¢, avg: 4670061¢, (53 prices/s)
51[2021/08/15 06:42:42:8803] N: sul_hz_cb: elatency: min: 131ms, max: 292ms, avg: 154ms, (53 msg/s)
52[2021/08/15 06:42:43:8803] N: sul_hz_cb: price: min: 4669646¢, max: 4672159¢, avg: 4669953¢, (34 prices/s)
53[2021/08/15 06:42:43:8803] N: sul_hz_cb: elatency: min: 130ms, max: 149ms, avg: 133ms, (34 msg/s)
54[2021/08/15 06:42:44:8804] N: sul_hz_cb: price: min: 4669455¢, max: 4672159¢, avg: 4669904¢, (26 prices/s)
55...
56```
57