0.0
No commit activity in last 3 years
No release in over 3 years
Simple websocket libraries
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

< 1.0.0, >= 0.1.30
~> 1.2.2
 Project Readme

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