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:
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
Post a Comment