Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.21 KB

README.md

File metadata and controls

45 lines (35 loc) · 1.21 KB

socketify.rb

Fast WebSocket and Http/Https server using an native extension with C API from uNetworking/uWebSockets

This Project will resume when socketify.py gets its v0.1.0 release!

Overly simple hello world app

require "socketify"

Socketify::App.new()
.get("/", lambda {|response, request| response.end("Hello World socketify from Ruby!")})
.listen(8082, lambda {|config| puts "Listening on port #{config.port}" })
.run()

Gemfile

gem 'socketify', git: 'https://github.com/cirospaciari/socketify.rb.git', branch: 'main', submodules: true

Run

bundle exec ruby ./hello_world.rb

SSL version sample

require "socketify"

Socketify::SSLApp.new({
    key_file_name: "./misc/key.pem",
    cert_file_name: "./misc/cert.pem", 
    passphrase: "1234"
})
.get("/", lambda {|response, request| response.end("Hello World socketify from Ruby!")})
.listen(8082, lambda {|config| puts "Listening on port #{config.port}" })
.run()

Build and Test Local

cd ./ext/socketify && ruby extconf.rb && make && cd ../../ && ruby -Ilib:ext -r socketify ./tests/hello_world.rb