Method: Binance::Client::WebSocket#single

Defined in:
lib/binance/client/websocket.rb

#single(stream:, methods:) ⇒ Object

Public: Create a single WebSocket stream

:stream - The Hash used to define the stream

:symbol   - The String symbol to 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 message
:error   - The Proc called when a stream receives an error (optional)
:close   - The Proc called when a stream is closed (optional)


24
25
26
27
# File 'lib/binance/client/websocket.rb', line 24

def single(stream:, methods:)
  create_stream("#{BASE_URL}/ws/#{stream_url(stream)}",
                methods: methods)
end