ratchet

How do I keep a websocket server running, even after I close the SSH terminal?

你。 提交于 2019-12-20 09:41:14
问题 So, I am using Ratchet with PHP, and have currently uploaded a successful websocket example to my server. It works after I go to SSH, and then just manually run "php bin/chat-server.php". What I was wondering is that, in a commercial situation, how do I keep the chat server running? Thanks. 回答1: Make a daemon. If you are using symfony2, you can use the Process Component. // in your server start command $process = new Process('/usr/bin/php bin/chat-server.php'); $process->start(); sleep(1); if

Send user ID from browser to websocket server while opening connection

我只是一个虾纸丫 提交于 2019-12-18 17:29:44
问题 Before asking this question, I did my best by reading severel questions on SO (tagged Ratchet and dealing with similar issues but to no avail. I even asked a question which received no attention and I therefore deleted it to write another one (that hopefully is more clear). My final goal is to build a one-to-one private chat application using Ratchet. Everything is working fine except that I can't send message to a specific user. Every logged in user connects to the websocket server while

PHP Fatal error: Class 'MyApp\Chat' not found in /MyApp/chat-server.php

一个人想着一个人 提交于 2019-12-18 12:16:29
问题 I am trying to run the Ratchet application demo but I can't execute the file This is my file structure /var/www/src/MyApp/ /var/www/src/MyApp/chat.php /var/www/src/MyApp/chat-server.php <?php use Ratchet\Server\IoServer; use MyApp\Chat; #require "chat.php"; require 'vendor/autoload.php'; $server = IoServer::factory( new Chat(), 8080 ); $server->run(); /var/www/src/MyApp/composer.json { "autoload": { "psr-0": { "MyApp": "src" } }, "require": { "cboden/Ratchet": "0.3.*" } } Vendor Folder is

php websocket forwarding to nodejs

元气小坏坏 提交于 2019-12-13 04:25:38
问题 im tring to create an adapter in php to forward messages from javascript client to nodejs server and vice versa. WebSockets: nodejs server: ws php server: RatchetPHP php client: RatchetPawl Code: websocket server in php: chatWSServer.php connection class: connection.php javascript client: connection = new WebSocket('ws://localhost:9000'); connection.onmessage = (e) => { console.log(e.data); } connection.onopen = (e) => { console.log("connection established!"); } connection.addEventListener(

PHP WebSocket ZMQ - Chat Operation - Send data to specific user

江枫思渺然 提交于 2019-12-12 21:08:21
问题 im working on a PHP project based on Symfony 2.2.11 and I installed the socketo related to the following tutorial http://socketo.me/docs/install to make my chat script working. ServerCommand.php // Code of the command line that starts the WebSocket server $oLoop = Factory::create(); // Listen for the web server to make a ZeroMQ push after an ajax request $oContext = new Context($oLoop); $oPull = $oContext->getSocket(\ZMQ::SOCKET_PULL); // LET IT 127.0.0.1 $oPull->bind('tcp://127.0.0.1:5555');

Laravel Ratchet socket Auth

有些话、适合烂在心里 提交于 2019-12-12 18:19:47
问题 I am starting learning Ratchet (reactPHP) I am using laravel. But I came to a line about security. How can I deny websocket connection based on user is logged in or not public function onOpen(ConnectionInterface $conn) { $this->clients->attach($conn); $this->users[$conn->resourceId] = $conn; if(Auth::check()){ echo 'user logged in'; }else{ echo "New connection! ({$conn->resourceId})\n"; } } I used something like this but it passes the Auth::check and console always shows New Connection. 回答1:

Ratchet Store Connection of User & Send Message Outside of Server Instance

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 09:45:36
问题 I have been following along with the tutorials here and got the ratchet server working. My chat class is the same as the tutorial more or less at the moment, so no point in showing that here yet since my question is more about implementation strategy . In the question I attached the user was looking how to get the connection object of a specific user. In the top answer solution keeping track of the resource IDs seems to be the way to do this. For example when the connection is created there

Cakephp 3: React/zmq library namespace

流过昼夜 提交于 2019-12-12 04:25:50
问题 I am working on on the basic tutorial on using ratchet mentioned here http://socketo.me/docs/push. I have created a test setup for the tutorial that works flawlessly. However, when I am trying to integrate the setup with CakePHP 3 I am running into problems. The ratchet and ZMQ servers are independent just the way mentioned in the tutorial. Only the following piece of code needs to move into CakePHP 3 controllers: $context = new ZMQContext(); $socket = $context->getSocket(ZMQ::SOCKET_PUSH,

Ratchet Websocket can't receive data from client?

随声附和 提交于 2019-12-12 00:42:36
问题 I have a real time web application with the frameWork Symfony. I need to send data from client to the webscket server.so I have try this : var conn = new WebSocket('ws://127.0.0.1:8080'); console.log (conn); conn.onopen = function (e) { console.log ("Connection established!"); conn.send("xoxo"); }; It does't show any error and in the server side I have this : The Server Code : $app=new AggregateApplication(); $loop = \React\EventLoop\Factory::create(); $context = new \React\ZMQ\Context($loop)

Setting up Ratchet on AWS

元气小坏坏 提交于 2019-12-11 16:59:15
问题 I am trying to enable web services on my AWS elastic beanstalk LAMP project. I just want to set up an auditing system. My requirements are fairly simple: Websocket connection Save incoming (JSON) messages to my mySQL db In this regard, I asked this question yesterday: How can I set up Web Sockets on AWS and log incoming messages to s3 (elastic beanstalk project) mysql db But having read the answer I got on this, and reading through the AWS API Gateway documentation I linked to on that