Skip to content

cirospaciari/socketify.rb

Repository files navigation

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

About

Bringing WebSockets, Http/Https High Peformance servers for Ruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published