
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.
express-io-pubsub
Advanced tools
Express server connects to either a MongoDB capped collection or publishes to a Redis channel. This is accomplished through simple middleware making request.publish(room, event, data) available
Socket.io server connects to the same collection or subscribes to a Redis channel. This is done through a listen command, and then the client can join the room/channel to listen to.
express = require 'express'
http = require 'http'
io = require 'socket.io'
pubsub = require '../../lib/express-io-pubsub'
app = express()
server = http.createServer app
io = io.listen server
app.get '/', (req, res) ->
res.send '
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect("http://localhost:3001");
socket.on("connect", function(data) {
socket.emit("join room", "lobby");
socket.on("update", function (data) {
var p = document.createElement("p");
var t = document.createTextNode(data.msg);
p.appendChild(t);
document.body.appendChild(p);
});
});
</script>
<body><p>waiting for messages</p></body>
'
io.sockets.on 'connection', (socket) ->
socket.on 'join room', (room) ->
socket.join room
pubsub.listen io.sockets, {
collection: 'events'
database: 'test'
host: 'localhost'
port: 27017
type: 'mongodb'
}
server.listen 3001
express = require 'express'
pubsub = require '../../lib/express-io-pubsub'
app = express()
app.configure () ->
app.use pubsub.middleware {
collection: 'events'
database: 'test'
host: 'localhost'
port: 27017
type: 'mongodb'
}
app.get '/', (req, res) ->
req.publish "lobby", "update", {msg: 'Hello World!'}
res.send "message sent"
app.listen 3002
Copyright (c) 2012 Bryant Williams <b.n.williams@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
FAQs
Express to Socket.io pubsub
The npm package express-io-pubsub receives a total of 5 weekly downloads. As such, express-io-pubsub popularity was classified as not popular.
We found that express-io-pubsub 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.