
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
#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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.