Method: Binance::Client::WebSocket#multi
- Defined in:
- lib/binance/client/websocket.rb
#multi(streams:, methods:) ⇒ Object
Public: Create multiple WebSocket streams
:streams - The Array of Hashes used to define the stream. Each Hash can
have the following keys:
:symbol - The String symbol the stream will listen to
:type - The String type of stream to listen to
:level - The String level to use for the depth stream (optional)
:interval - The String interval to use for the kline stream (optional)
:methods - The Hash which contains the event handler methods to pass to
the WebSocket client
:open - The Proc called when a stream is opened (optional)
:message - The Proc called when a stream receives a
:error - The Proc called when a stream receives an error (optional)
:close - The Proc called when a stream is closed (optional)
44 45 46 47 48 |
# File 'lib/binance/client/websocket.rb', line 44 def multi(streams:, methods:) names = streams.map { |stream| stream_url(stream) } create_stream("#{BASE_URL}/stream?streams=#{names.join('/')}", methods: methods) end |