Search Results

Search found 2 results on 1 pages for 'sumwon'.

Page 1/1 | 1 

  • Why Won't the WebSocket.onmessage Event Fire?

    - by SumWon
    Hey guys, After toying around with this for hours, I simply cannot find a solution. I'm working on a WebSocket server using "node.js" for a canvas based online game I'm developing. My game can connect to the server just fine, it accepts the handshake and can even send messages to the server. However, when the server responds to the client, the client doesn't get the message. No errors, nothing, it just sits there peacefully. I've ripped apart my code, trying everything I could think of to fix this, but alas, nothing. Here's a stripped copy of my server code. As I said before, the handshake works fine, the server receives data fine, but sending data back to the client does not. var sys = require('sys'), net = require('net'); var server = net.createServer(function (stream) { stream.setEncoding('utf8'); var shaken = 0; stream.addListener('connect', function () { sys.puts("New connection from: "+stream.remoteAddress); }); stream.addListener('data', function (data) { if (!shaken) { sys.puts("Handshaking..."); //Send handshake: stream.write( "HTTP/1.1 101 Web Socket Protocol Handshake\r\n"+ "Upgrade: WebSocket\r\n"+ "Connection: Upgrade\r\n"+ "WebSocket-Origin: http://192.168.1.113\r\n"+ "WebSocket-Location: ws://192.168.1.71:7070/\r\n\r\n"); shaken=1; sys.puts("Handshaking complete."); } else { //Message received, respond with 'testMessage' var d = "testMessage"; var m = '\u0000' + d + '\uffff'; sys.puts("Sending '"+m+"' to client"); var result = stream.write(m, "utf8"); sys.puts(result); /* Result comes as true, meaning that it pushed the data out. Why isn't the client seeing it?!? */ } }); stream.addListener('end', function () { sys.puts("Connection closed!"); stream.end(); }); }); server.listen(7070); sys.puts("Server Started!");

    Read the article

  • PHP Multi-Domain Sessions; ini_set Not Working?

    - by SumWon
    Hello, I'm trying to set it up so if you log in to my website the session carries over to all sub-domains of my website. For example, if you go to domain.com and log in, then go to sub.domain.com, you'll already be logged in at sub.domain.com. To my understanding, you would want to use ini_set('session.cookie_domain','.domain.com') and then session_start(), then set your session variables, but this isn't working. Example of what I'm doing: Code for domain.com: <?php ini_set('session.cookie_domain','.domain.com'); session_start(); $_SESSION['variable'] = 1; ?> Code for sub.domain.com: <?php session_start(); echo $_SESSION['variable']; ?> But $_SESSION['variable'] isn't set. I've also tried using ini_set() in the sub.domain.com code, but it made no difference. I've verified that setting session.cookie_domain is working by using ini_get(). What am I doing wrong? Thanks!

    Read the article

1