phpwebsocket

setting up websockets without command line

别等时光非礼了梦想. 提交于 2019-12-03 04:25:19
问题 How can I follow a tutorial like this without using the command line? http://www.flynsarmy.com/2012/02/php-websocket-chat-application-2-0/ I need to be able to use websockets but have a shared server and no access to the command line. I cannot simply run the script from a browser, if the script would stop running when i closed the browser/disconnected from the internet. 回答1: Assuming your shared hosting provider supports crontab and cron jobs (most of them do), add the following job to the

How to call a WebSocket programmatically (using PHP)?

会有一股神秘感。 提交于 2019-12-03 03:33:16
I have a situation where I need to update one browser window based on input from the other. Right now I'm using WebSockets and it's working great. Now I want to send data to the WebSocket using PHP instead of the browser (so instead of ws://, use PHP code). In other words, I want to simulate the WebSocket.send() call using PHP instead of JavaScript. I have the following code which doesn't seem to work (the onmessage is not being called): if ( function_exists('socket_create') AND $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP) AND $sock_data = socket_connect($sock, "127.0.0.1", 12345) ) {

Which is more efficient to send WebSocket updates with a MySQL database change

为君一笑 提交于 2019-12-01 08:23:27
I'm currently experimenting with WebSockets in a bid to reduce / remove the need for constant AJAX requests in a potentially low bandwidth environment. All devices are WebSocket compliant so there's no issue there, and I'm trying to keep it to native PHP WebSockets, no node.js or other frameworks / libraries (Which so far has been fine). What I'm looking to do is to decide how to go about notifying connected clients about an update to a database by another Client. The use case in question is a person pressing a button on their device, which then alerts that persons manager(s) to that press. So

An Issue with an AWS EC2 instance WebSocket connection failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

做~自己de王妃 提交于 2019-11-29 17:20:19
As I tried to run the chat app from localhost connected to MySQL database which had been coded with PHP via WebSocket it was successful. Also when I tried to run from the PuTTY terminal logged into SSH credentials, it was displaying as Server Started with the port# 8080 ubuntu@ec3-193-123-96:/home/admin/web/ec3-193-123-96.eu-central-1.compute.amazonaws.com/public_html/application/libraries/server$ php websocket_server.php PHP Fatal error: Uncaught React\Socket\ConnectionException: Could not bind to tcp://0.0.0.0:8080: Address already in use in /home/admin/web/ec3-193-123-96.eu-central-1

Error with PHP Websocket and Wamp Server

百般思念 提交于 2019-11-29 07:51:05
I'm really new about this of Websockets, i'm trying to connect this websocket: phpwebsocket with WAMP server, first, in my httpd.conf I wrote listen 9300, and if i go to localhost:9300 it works right, but when I go to console and write: php -q C:\wamp\www\demos\server.php I got this error: Here's the code of server.php: <?php set_time_limit(0); require 'class.PHPWebSocket.php'; function wsOnMessage($clientID, $message, $messageLength, $binary) { global $Server; $ip = long2ip( $Server->wsClients[$clientID][6] ); if ($messageLength == 0) { $Server->wsClose($clientID); return; } if ( sizeof(

An Issue with an AWS EC2 instance WebSocket connection failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

…衆ロ難τιáo~ 提交于 2019-11-28 11:09:40
问题 As I tried to run the chat app from localhost connected to MySQL database which had been coded with PHP via WebSocket it was successful. Also when I tried to run from the PuTTY terminal logged into SSH credentials, it was displaying as Server Started with the port# 8080 ubuntu@ec3-193-123-96:/home/admin/web/ec3-193-123-96.eu-central-1.compute.amazonaws.com/public_html/application/libraries/server$ php websocket_server.php PHP Fatal error: Uncaught React\Socket\ConnectionException: Could not

Error with PHP Websocket and Wamp Server

南笙酒味 提交于 2019-11-28 01:37:07
问题 I'm really new about this of Websockets, i'm trying to connect this websocket: phpwebsocket with WAMP server, first, in my httpd.conf I wrote listen 9300, and if i go to localhost:9300 it works right, but when I go to console and write: php -q C:\wamp\www\demos\server.php I got this error: Here's the code of server.php: <?php set_time_limit(0); require 'class.PHPWebSocket.php'; function wsOnMessage($clientID, $message, $messageLength, $binary) { global $Server; $ip = long2ip( $Server-

Using WebSocket on Apache server

旧街凉风 提交于 2019-11-27 11:40:12
With all the buzz around WebSockets, it's pretty hard to find a good walkthrough on how to use them with an Apache server on Google. We're developing a plugin, in PHP (symfony2), which will run from time to time kind of a chat instance. And we find WebSockets more interesting, standard and quick than AJAX for this matter. The thing is, we don't have much sysadmin ressources in our group and we find hard to gather good informations on the following matters: Can we run a WebSocket instance on a traditional Apache, dedicated server, and if yes, do you have useful links for us? If we need to mod

Using WebSocket on Apache server

♀尐吖头ヾ 提交于 2019-11-26 15:40:36
问题 With all the buzz around WebSockets, it's pretty hard to find a good walkthrough on how to use them with an Apache server on Google. We're developing a plugin, in PHP (symfony2), which will run from time to time kind of a chat instance. And we find WebSockets more interesting, standard and quick than AJAX for this matter. The thing is, we don't have much sysadmin ressources in our group and we find hard to gather good informations on the following matters: Can we run a WebSocket instance on a