Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created Jun 25, 2020
Embed
What would you like to do?
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