Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (43 sloc) 1.26 KB



Server Side


Client Side

The client side code is from within this repository

<script "./example/static/sws.js"></script>


  • On a server with
  • * Connect.session
  • Get a session verifier

    var sws = require("SessionWebSocket")()

  • Setup the server

    var server = connect.createServer( ... connect.cookieDecoder(), connect.session(...), sws.http //not a function ... )

  • Setup

    //put our callback inside of io.listen(server,{ //normal callback client.on("secure",function(){ console.log(client.session) //client.session is now available }) client.on("insecure",function(){ // fires when a message that is not the auth message arrives first }) }))

Usage Client Side

<script "./example/static/sws.js"></script>
    socket.send("woot!")//good to go


  • secure - fires when auth sucedes, does not put the auth token in a "message" event
  • insecure - fires when auth fails, and then fires the "message" event
Jump to Line
Something went wrong with that request. Please try again.