Created
November 6, 2015 17:03
-
-
Save scripting/59498807e081b876a2b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ws = require ("nodejs-websocket"); | |
var myPort = 1337; | |
function handleConnection (conn) { | |
conn.on ("text", function (s) { | |
var returnstring = s.toUpperCase () + "!!!"; | |
console.log ("handleConnection: returning " + returnstring); | |
conn.sendText (returnstring) | |
}); | |
} | |
ws.createServer (handleConnection).listen (myPort); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See this blog post for background..
http://scripting.com/2015/11/06/websocketsHelloWorld.html