Class List Method List File List

# Class: Vertx::SockJSSocket

Inherits:
  Object
  - Object
  - Vertx::SockJSSocket
  show all
Includes:
  ReadStream, WriteStream
Defined in:
  src/main/ruby_scripts/core/sock_js.rb

## Overview

You interact with SockJS clients through instances of SockJS socket. The API is very similar to WebSocket. It implements both ReadStream and WriteStream so it can be used with Pump to enable flow control.

Author:

- Tim Fox

## Instance Method Summary (collapse)

- - (Object) close
  Close the socket.
- - (Object) handler_id
  When a SockJSSocket is created it automatically registers an event handler with the system, the ID of that handler is given by #handler_id.

### Methods included from ReadStream

#data_handler, #end_handler, #exception_handler, #pause, #resume

### Methods included from WriteStream

#drain_handler, #exception_handler, #write_buffer, #write_queue_full?, #write_queue_max_size=

## Instance Method Details

### - (`Object`) close

Close the socket

    94
    95
    96
    97
    # File 'src/main/ruby_scripts/core/sock_js.rb', line 94

    def close
      EventBus.unregister_handler(@handler_id)
      @j_del.close
    end

### - (`Object`) handler_id

When a SockJSSocket is created it automatically registers an event handler with the system, the ID of that handler is given by #handler_id. Given this ID, a different event loop can send a buffer to that event handler using the event bus. This allows you to write data to other SockJSSockets which are owned by different event loops.

    103
    104
    105
    # File 'src/main/ruby_scripts/core/sock_js.rb', line 103

    def handler_id
      @handler_id
    end