OH, HI
I create chat app with server written with node.js and faye.
- clients subscribe
/messages/new
Messages going that way:
client
--[publish to /messages]-->
server side client--[publish to /messages/new]-->
all clients
But if I'm a Anonymus H4x0r I can edit client js file and make my client publish messages not on /messages
, but on /messages/new
. Messages will pass over the server side client and go directly to clients.
I want messages to go via server side client, cause server do magic: validates token, saves message in redis database and logs
Question
How to disable specific channel for publish by clients?
Should I write custom engine? I didn't find any channels configuration in Faye server. Let me know, if you want to see some code, dunno what to show you.
Note
createServer = ->
server = http.createServer()
server.listen settings.serverPort
bayeux = new faye.NodeAdapter ##################################
mount: '/faye' # This is "server side client"
timeout: 45 # lol
bayeux.attach server ##################################
fayeClient = bayeux.getClient()
log "listening on port #{settings.serverPort}..."
return [fayeClient, bayeux]
Edits
- Edit: rename "server" to "server side client"
- Edit2: add
Note