
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
#em-websocket-server
##Installation
gem install em-websocket-server -s http://gemcutter.org
##Dependencies
##Explain To leverage em-websocket-server, you simply need to extend EM::WebSocket::Server and register the server with eventmachine. When a client connects, EventMachine will create a new instance of your class, and allow your application specific code to be executed in the context of said instance.
##Methods to override:
#called on exception
on_error error
#called when a client sends a message
on_receive msg
#called when a client connects
on_connect
#called when a client is disconnected
on_disconnect
##Other useful methods
#send a message
send_message msg
#close the connection
unbind
##Macros macros are used to configure your application server.
class MySweetHandler < EM::WebSocket::Server
#secure incoming connections
secure
#secure incoming connections, with given key/cert
secure {
:private_key_file => "/path/to/private/key",
:cert_chain_file => "/path/to/ssl/certificate"
}
#provide a flash socket policy
flash_policy "/usr/local/policies/domain.com/crossdomain.xml"
end
##Quick Example
require "rubygems"
require "em-websocket-server"
class EchoServer < EM::WebSocket::Server
def on_connect
EM::WebSocket::Log.debug "Connected"
end
def on_receive msg
send_message msg
end
end
EM.run do
EM.start_server "0.0.0.0", 8000, EchoServer
end
##SSL
class SecureEchoServer < EM::WebSocket::Server
#provide cert and key
secure {
:private_key_file => "/path/to/private/key",
:cert_chain_file => "/path/to/ssl/certificate"
}
...
end
EM.run do
EM.start_server "0.0.0.0", 443, SecureEchoServer
end
##Custom Flash Policy
class FlashyEchoServer < EM::WebSocket::Server
flash_policy "/usr/local/policies/domain.com/crossdomain.xml"
end
EM.run do
EM.start_server "0.0.0.0", 8000, FlashyEchoServer
end
##Todo
##Thanks
FAQs
Unknown package
We found that em-websocket-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.