🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

bogo-websocket

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bogo-websocket

0.2.0
Rubygems
Version published
Maintainers
1
Created
Source

Bogo Websocket

Simple websocket library

Usage

Basic Usage

require 'bogo-websocket'

socket = Bogo::Websocket::Client.new(
  :destination => 'ws://example.com:8080',
  :path => '/websocket',
  :params => {
    :fubar => true
  },
  :headers => {
    'X-WOW' => 'custom header'
  },
  :on_connect => proc{
    puts 'Socket Connected'
  },
  :on_disconnect => proc{
    puts 'Socket Disconnected'
  },
  :on_error => proc{|error|
    puts "Error caught: #{error.class} - #{error}"
  },
  :on_message => proc{|msg|
    puts "Received message: #{msg.inspect}"
  }
)
socket.write('stuff')

SSL Usage

socket = Bogo::Websocket::Client.new(
  :destination => 'wss://example.com:8080',
  ...

SSL Usage with Client Key/Certificate

socket = Bogo::Websocket::Client.new(
  :destination => 'wss://example.com:8080',
  :ssl_key => '/local/path/to/key',
  :ssl_certificate => '/local/path/to/cert',
  ...

SSL Usage with Custom Context

ssl_ctx = OpenSSL::SSL::SSLContext.new
...
socket = Bogo::Websocket::Client.new(
  :destination => 'wss://example.com:8080',
  :ssl_context => ssl_ctx,
  ...

Info

  • Repository: https://github.com/spox/bogo-websocket

FAQs

Package last updated on 18 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

OSZAR »