Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 25, 2020 11:50
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 velotiotech/fb67d5efe3029174abc6991089a910e1 to your computer and use it in GitHub Desktop.
Save velotiotech/fb67d5efe3029174abc6991089a910e1 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