dongliang1873 2015-11-11 19:08
浏览 46

在Laravel 5.1中使用棘轮和网络插座

I'm implementing a chat inside my app, and I already got it to work locally using ratchet and websockets, but I have three doubts.

  • In order for getting it to work I need to run my server created in this script:

    <?php require __DIR__ . '/../vendor/autoload.php';
    
    use Subway\Http\Controllers\ChatController;
    use Ratchet\Server\IoServer;
    use Ratchet\Http\HttpServer;
    use Ratchet\WebSocket\WsServer;
    
    $server = IoServer::factory(new HttpServer(new WsServer(new ChatController)), 3000);
    
    $server->run();
    

    so in my terminal I need to run: php bin/server.php in order to make it work correctly. The thing is, is there a way in Laravel to start that php script when I start laravel service with php artisan serve?

  • The other doubt is that I used the local ip "127.0.0.1" just for testing purposes, but, when I get it to the server, which ip should I use?

  • For another test, I changed the local ip for my real ip which is "192.168.1.31", and a partner inside the same network, tested the chat, and we had communication with each other, but, when he gets to another section of the webpage, I automatically get disconnected, and the terminal stops running the server.php script, what could you tell me about the solution to this?

If Ratchet won't work for this implementation, I would be greatful if you could tell me how to use "Pusher" service inside laravel 5.1.

Thanks!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据
    • ¥20 软件测试决策法疑问求解答