简体   繁体   English

Laravel Workbench实时聊天

[英]Laravel workbench real-time chat

I am followed up this guide ' https://medium.com/laravel-4/laravel-4-real-time-chat-eaa550829538 ', to create real-time chat in my app. 我会按照本指南' https://medium.com/laravel-4/laravel-4-real-time-chat-eaa550829538 '进行操作,以在我的应用程序中创建实时聊天。 All was alright, before "workbench" moment. 在“工作台”时刻之前,一切都很好。 I created "formativ/chat" workbench with composer, then created and fill files. 我用作曲家创建了“ formativ / chat”工作台,然后创建并填充文件。 After, i run "composer update" in 之后,我在运行“ composer update”

'workbench/formativ/chat' '工作台/格式iv /聊天'

directory and added 目录并添加

'Formativ\\Chat\\ChatServiceProvider' 'Formativ \\ Chat \\ ChatServiceProvider'

to app.php. 到app.php。 But then 'ember.js' just throw error in console 但是然后“ ember.js”只是在控制台中抛出错误

'can't establish a connection to the server at ws://127.0.0.1:7778/.' “无法在ws://127.0.0.1:7778 /建立与服务器的连接。”

and nothing worked. 没有任何效果。 Also if i'll write not-valide php code in 另外,如果我要在其中编写无效的php代码

workbench/formativ/chat/chat/command/Server.php 工作台/ formativ /聊天/聊天/命令/Server.php

laravel will no throw any error laravel不会抛出任何错误

Update 更新资料

I finally got 'ServiceProvider' to work. 我终于让“ ServiceProvider”工作了。 But other files didn't work. 但是其他文件不起作用。 I connected them to ServiceProvider with 我将它们连接到ServiceProvider

$this->app->bind("chat.chat", function()
{
        return new Chat(
            $this->app->make("chat.emitter")
        );
});

In my workbench i have this architecture 在我的工作台上,我有这个架构

workbench_folder->vendor/appname/src/vendom/appname/ workbench_folder->供应商/应用名称/ src / vendom /应用名称/

Command\Serve.php
Chat.php
ChatInterface.php
ChatServiceProvider.php
User.php
UserInterface.php

Just typed "php artisan chat:serve" and all works. 只需输入“ php artisan chat:serve”即可,并且所有作品都可以。 Not found it in tutorial 在教程中找不到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM