Skip to content
Advertisement

Passing variable to php websocket

I cant figure out, how to pass variables to websocket. For example, I get calculations before launching websocket, and I would love to pass results to websocket, to compare them on each update until I get result I’m waiting for. Is there a way to do it? I was able to kind if make it work by creating cache, and reading it on message update, but takes way too much resources, and memory gets clogged very fast.

JavaScript

Advertisement

Answer

I was able to pass variables with $GLOBALS['variable']; With these I can pass values from one websocket message to another and memory resources usage is fairly low.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement