Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dougley committed Jan 17, 2017
1 parent bd3d938 commit ef11260
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ build/Release
# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules

config.json
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}\\Bezerk.js",
"cwd": "${workspaceRoot}",
"env": {
"DEBUG": "bezerk*"
}
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"port": 5858
}
]
}
7 changes: 4 additions & 3 deletions Bezerk.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ BezerkWS.on('connection', (socket) => {

function process (socket, message) {
Logger('Attempting to process a message.')
Logger(message)
let msg
try {
JSON.parse(message)
msg = JSON.parse(message)
} catch (e) {
socket.close()
Logger('Closing socket, invalid data received.')
Expand Down Expand Up @@ -105,9 +106,9 @@ function process (socket, message) {
} else {
Logger('Request accepted, attempting to send data to subscribed listeners.')
for (let listener of receivers) {
if (listener.indexOf(msg.c) > -1) {
if (listener.subscriptions.indexOf(msg.op) > -1 && listener.readyState === 1) {
Logger('Sending data.')
listener.send(msg)
listener.send(JSON.stringify(msg))
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@

---
<h1 align="center"> Go bezerk!</h1>
Bezerk is a stand-alone websocket manager for [WildBeast](https://github.com/TheSharks/WildBeast), spin it up, reconfigure WildBeast to connect to Bezerk and you're ready to go!

Bezerk is a stand-alone websocket manager for [WildBeast](https://github.com/TheSharks/WildBeast), spin it up, reconfigure WildBeast to connect to Bezerk and you're ready to go!

0 comments on commit ef11260

Please sign in to comment.