joni-jones / yii2-wschat

Online chat based on web sockets
MIT License
99 stars 43 forks source link

Using chat without MongDB server #22

Open koredalin opened 7 years ago

koredalin commented 7 years ago

I use XAMPP. php v5.6.15. MySql server. I have istalled: "dektrium/yii2-user": "^0.9.12", "joni-jones/yii2-wschat": "^1.0", "yiisoft/yii2-mongodb": "^2.1" I have installed php mongodb extension too. The console server started with no errors. However - there is a set of JS errors. The server is started: C:>netstat -na | find "8080" TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING My ServerController: class ServerController extends \yii\console\Controller { public function actionRun() { $manager = \Yii::configure(new ChatManager(), [ 'userClassName' => '\yii\db\ActiveRecord' //allow to get users from MySQL or PostgreSQL // 'userClassName' => '\dektrium\user\models\User' //allow to get users from MySQL or PostgreSQL ]); $server = IoServer::factory(new HttpServer(new WsServer(new Chat($manager))), 8080); $server->run(); } } console.php 'mongodb' => [ 'class' => '\yii\mongodb\Connection', 'dsn' => 'mongodb://wschat:wschat@localhost:27017/wschat' ], 'db' => $db, 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'flushInterval' => 1, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning', 'info'], 'logVars' => [], 'exportInterval' => 1 ], ], ],

My view: echo ChatWidget::widget([ 'auth' => true, 'user_id' => \Yii::$app->user->getIdentity()->id ]);

There are many errors in the JS console: GET http://localhost/wschat/web/assets/733e3305/underscore/underscore-min.js - 404 Exception backbone.js:382 Uncaught TypeError: Cannot read property 'extend' of undefined at backbone.js:382 at backbone.js:31 at backbone.js:34 These are only in the beginning.

What can I do next? Thank you for the help!