Persistent variables and remoting

55 views
Skip to first unread message

tom rhodes

unread,
Sep 9, 2017, 5:29:55 AM9/9/17
to Haxe
Hi all,

A long long time ago I seem to remember being able to have a persistent variable in a haxe remoting server. Just trying now with a static var but it's resetting every call, I've had a quick google but can't find the ancient page that showed me how to do it all those years ago ;)

Anyone remember?

Cheers,

Tom.

Juraj Kirchheim

unread,
Sep 9, 2017, 9:52:21 AM9/9/17
to haxe...@googlegroups.com
You should be more specific ;)

If you're using remoting over HTTP to mod_neko (or similar), then you need to use neko.Web.cacheModule to extend the life cycle of static vars across requests.

Best,
Juraj

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

tom rhodes

unread,
Sep 10, 2017, 4:34:32 AM9/10/17
to haxe...@googlegroups.com
Hey, that was it, cacheModule not available in PHP? Thanks, I'll have a refresher read now. 

btw is it just me or has the list gone quiet? Is everyone in a telegram group or something?

Juraj Kirchheim

unread,
Sep 10, 2017, 5:39:00 AM9/10/17
to haxe...@googlegroups.com
I would have to guess it's a seasonal thing. I also follow the nodejs group which in general is quite a bit more active than ours, but in the past few weeks there was way less movement than here FWIW.

As for PHP, you'll either have to use a few extra tricks (with in memory stores or something) or implement `php.Web` for ReactPHP (blocking on every request).

tom rhodes

unread,
Sep 10, 2017, 6:01:45 AM9/10/17
to haxe...@googlegroups.com
I think I'm going to have to use a session but I wanted to avoid leaving anything on the client as I don't want the bots to knwo I'm trying to see if they are human or not... 

I'll look at ReactPHP, thanks again.

Juraj Kirchheim

unread,
Sep 10, 2017, 7:06:31 AM9/10/17
to haxe...@googlegroups.com
Just to clarify: cacheModule persists global states across *all* requests while sessions are per-client. If you just dump data somewhere after a request is processed and read it back before processing the next, you get *roughly* the same behaviour (plus race conditions for requests processed in parallel). There's a wide range of caching solutions for PHP (beyond sessions) and I'm rather optimistic that at least one of them had an elegant solution to your particular problem ;)
Reply all
Reply to author
Forward
0 new messages