added WebSockets API login
This commit is contained in:
parent
5a75f389ad
commit
17e4fca9fd
7
app.js
7
app.js
@ -42,6 +42,13 @@ api.on('connection', function(spark) {
|
|||||||
console.log('got hello data from ', spark.id);
|
console.log('got hello data from ', spark.id);
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
|
if(typeof data.secret === 'undefined' || data.secret !== process.env.WS_SECRET)
|
||||||
|
{
|
||||||
|
spark.end(undefined, { reconnect: false });
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(typeof data.id !== 'undefined' && typeof data.info !== 'undefined')
|
if(typeof data.id !== 'undefined' && typeof data.info !== 'undefined')
|
||||||
{
|
{
|
||||||
data.ip = spark.address.ip;
|
data.ip = spark.address.ip;
|
||||||
|
Loading…
Reference in New Issue
Block a user