Skip to content

Instantly share code, notes, and snippets.

@rachitpsolanki
Created November 12, 2019 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rachitpsolanki/3277a4d4b306677cc9200e36749cf4e2 to your computer and use it in GitHub Desktop.
Save rachitpsolanki/3277a4d4b306677cc9200e36749cf4e2 to your computer and use it in GitHub Desktop.
add auth endpoint
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.post('/pusher/auth', function(req, res) {
var socketId = req.body.socket_id;
var channel = req.body.channel_name;
var auth = pusher.authenticate(socketId, channel);
res.send(auth);
});
var port = process.env.PORT || 5000;
app.listen(port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment