PHP WebSocket Client? Or way to run JavaScript inside of PHP (without a browser)? Hopefully with Ratchet -


i'm new websockets , have been playing ratchet , gotten simple chat room work on aws ec2 instance. i'm trying use service can run custom php script (hosted on servers) open websocket connection on server , send message.

i got ec2 url working, , when run in browser (including on phone, isn't on same network computer) works. i'm passing testing api key , value in url (grabbed php get), so:

http://ec2-22-222-22-222.us-west-2.compute.amazonaws.com/path/to/script/ws-trigger.php?key=12345&name=bing

this works, because ws-trigger.php page loads following javascript , runs browser:

<script type="text/javascript">     var conn = new websocket('ws://22.222.22.222:8080');     conn.onopen = function(e) {         console.log("connection established!");         conn.send(<?php echo $_get['name']; ?>);     }; </script> 

what easiest way me run "connect websocket" , "send message on socket" via php? if have use library i'd prefer use ratchet since am, feel must missing because cannot unique problem.

i have tried searching stackoverflow already, have had issues few answers i'd found (like phpwebsocket giving me troubles before moved ratchet, , this 1 isn't php ws client @ all)


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -