Closed akarelas closed 11 years ago
Yes, this is a problem with Twiggy. See Issue #1
I just installed your master version of Twiggy. Should that fix the problem? (I can't check just yet, have to install everything else, too)
Yes, that should work. I use myself. I think... :)
Why not mention in the README.md that your own Twiggy is required?
That way this here issue will be un-needed.
On 03/06/2013 05:26 PM, Alexander Karelas wrote:
Why not mention in the README.md that your own Twiggy is required?
That way this here issue will be un-needed.
— Reply to this email directly or view it on GitHub https://github.com/vti/sockjs-perl/issues/3#issuecomment-14504861.
Yes. I am going to add that.
Is "$stringifying" the session object the only way to get a unique id out of it?
What do you need it for? 09.03.2013 7:23 ÐÏÌØÚÏ×ÁÔÅÌØ "Alexander Karelas" notifications@github.com ÎÁÐÉÓÁÌ:
Is "$stringifying" the session object the only way to get a unique id out of it?
Reply to this email directly or view it on GitHubhttps://github.com/vti/sockjs-perl/issues/3#issuecomment-14658354 .
I will need to keep track of which clients are in each room (to emulate the rooms functionality from socket.io). Also which rooms each client is in. This requires at least two hashes with unique ids as keys.
Also, is there a future-proof way to hook a new subroutine on the "user closed his connection" event?
I was thinking of replacing $socket->{"on_aborted"} with a subroutine that first executes what was there before, and then executes my own code. Does that seem right?
For some reason, "on_aborted" is executed twice on browser-reload.
Maybe providing a way for either subclassing and/or setting custom variables for the session object would be a good idea. This way you could save your own unique ids, and overwrite events.
As for "executed twice" this could a bug.
Ok, now you can set/get custom values by using:
$session->set(foo => 'bar');
$session->get('foo');
And overwrite session creation by providing you own factory:
SockJS->new(session_factory => sub { MySessionClass->new })
Both changes worked very well. Thank you.
Thanks, that helps. The demo still fails using FireFox 12 and 23 (makes initial contact, but aborts during the xhr post). IE 9 also appears to fail (xhr issues again?). On the plus side, the example code works fine now using web sockets in the latest version of Chrome.
I'm going to check the Perl module dependencies on my end again, then try to pull down the latest copy of the sockjs (JavaScript) library just to make sure this isn't a client or configuration issue.
In the top-level README.md of this module, you get "The Client-Side Part" and "The Server-Side Part". I tried those out with Twiggy, using both version 0.3.4 and version 0.2.1 of the client, and when I try to load my webpage I get the following error on FireBug (latest FF):
So I look at the client code and insert a debugging line: console.log(text) right before JSON-parsing it, and see that text is not JSON at all! See for yourself below:
The "4f' and the "0" on the top & bottom are creating the problem.
Whose fault is it, vti? What can we do to fix it? I'm anxious to become a SockJS-Perl user!
Thanks