Using cboden/ratchet I got Interface 'RachetMessageComponentInterface' not found error
In my laravel 5.7 app I installed cboden/ratchet using some online docs
composer.json :
"type": "project",
"require": {
...
"cboden/ratchet": "^0.4.1",
With app/Classes/Socket/Base/BaseSocket.php :
<?php
namespace AppClassesSocketBase;
use RachetMessageComponentInterface;
use RachetConnectionInterface;
class BaseSocket implements MessageComponentInterface {
public function onOpen(ConnectionInterface $conn) {
}
public function onMessage(ConnectionInterface $conn, $mgs) {
}
public function onClose(ConnectionInterface $conn) {
}
public function onError(ConnectionInterface $conn, Exception $e) {
}
}
and console command app/Console/Commands/ChatServer.php :
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use RatchetHttpHttpServer;
use RatchetServerIoServer;
use RatchetWebSocketWsServer;
use AppClassesSocketChatSocket;
class ChatServer extends Command
{
protected $signature = 'chat_server:serve';
protected $description = 'chat_server description';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$this->info("Start server!");
$server= IoServer::factory(
new HttpServer(
new WsServer(
new ChatSocket()
)
),
8080
);
$server->run();
}
}
But running command in console I got error:
$ php artisan chat_server:serve
Start server!
PHP Fatal error: Interface 'RachetMessageComponentInterface' not found in /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php on line 7
SymfonyComponentDebugExceptionFatalErrorException : Interface 'RachetMessageComponentInterface' not found
at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
3|
4| use RachetMessageComponentInterface;
5| use RachetConnectionInterface;
6|
> 7| class BaseSocket implements MessageComponentInterface {
8|
9| public function onOpen(ConnectionInterface $conn) {
10|
11| }
WhoopsExceptionErrorException : Interface 'RachetMessageComponentInterface' not found
at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
3|
4| use RachetMessageComponentInterface;
5| use RachetConnectionInterface;
6|
> 7| class BaseSocket implements MessageComponentInterface {
8|
9| public function onOpen(ConnectionInterface $conn) {
10|
11| }
Did I miss some declarations or have I to add declarations to app.php ?
Reading docs I missed if I have add config declarations?
UPDATED BLOCK # 2:
Searching for decision I found an opinion, that I need to create my own service provider for it register it properly in Laravel
Which steps have I to do to create my own service provider for "cboden/ratchet" ? This is out of my laravel expierence...
Thanks!
laravel-5 socket.io ratchet
add a comment |
In my laravel 5.7 app I installed cboden/ratchet using some online docs
composer.json :
"type": "project",
"require": {
...
"cboden/ratchet": "^0.4.1",
With app/Classes/Socket/Base/BaseSocket.php :
<?php
namespace AppClassesSocketBase;
use RachetMessageComponentInterface;
use RachetConnectionInterface;
class BaseSocket implements MessageComponentInterface {
public function onOpen(ConnectionInterface $conn) {
}
public function onMessage(ConnectionInterface $conn, $mgs) {
}
public function onClose(ConnectionInterface $conn) {
}
public function onError(ConnectionInterface $conn, Exception $e) {
}
}
and console command app/Console/Commands/ChatServer.php :
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use RatchetHttpHttpServer;
use RatchetServerIoServer;
use RatchetWebSocketWsServer;
use AppClassesSocketChatSocket;
class ChatServer extends Command
{
protected $signature = 'chat_server:serve';
protected $description = 'chat_server description';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$this->info("Start server!");
$server= IoServer::factory(
new HttpServer(
new WsServer(
new ChatSocket()
)
),
8080
);
$server->run();
}
}
But running command in console I got error:
$ php artisan chat_server:serve
Start server!
PHP Fatal error: Interface 'RachetMessageComponentInterface' not found in /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php on line 7
SymfonyComponentDebugExceptionFatalErrorException : Interface 'RachetMessageComponentInterface' not found
at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
3|
4| use RachetMessageComponentInterface;
5| use RachetConnectionInterface;
6|
> 7| class BaseSocket implements MessageComponentInterface {
8|
9| public function onOpen(ConnectionInterface $conn) {
10|
11| }
WhoopsExceptionErrorException : Interface 'RachetMessageComponentInterface' not found
at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
3|
4| use RachetMessageComponentInterface;
5| use RachetConnectionInterface;
6|
> 7| class BaseSocket implements MessageComponentInterface {
8|
9| public function onOpen(ConnectionInterface $conn) {
10|
11| }
Did I miss some declarations or have I to add declarations to app.php ?
Reading docs I missed if I have add config declarations?
UPDATED BLOCK # 2:
Searching for decision I found an opinion, that I need to create my own service provider for it register it properly in Laravel
Which steps have I to do to create my own service provider for "cboden/ratchet" ? This is out of my laravel expierence...
Thanks!
laravel-5 socket.io ratchet
Please look at UPDATED BLOCK # 2
– mstdmstd
Nov 23 '18 at 7:09
add a comment |
In my laravel 5.7 app I installed cboden/ratchet using some online docs
composer.json :
"type": "project",
"require": {
...
"cboden/ratchet": "^0.4.1",
With app/Classes/Socket/Base/BaseSocket.php :
<?php
namespace AppClassesSocketBase;
use RachetMessageComponentInterface;
use RachetConnectionInterface;
class BaseSocket implements MessageComponentInterface {
public function onOpen(ConnectionInterface $conn) {
}
public function onMessage(ConnectionInterface $conn, $mgs) {
}
public function onClose(ConnectionInterface $conn) {
}
public function onError(ConnectionInterface $conn, Exception $e) {
}
}
and console command app/Console/Commands/ChatServer.php :
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use RatchetHttpHttpServer;
use RatchetServerIoServer;
use RatchetWebSocketWsServer;
use AppClassesSocketChatSocket;
class ChatServer extends Command
{
protected $signature = 'chat_server:serve';
protected $description = 'chat_server description';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$this->info("Start server!");
$server= IoServer::factory(
new HttpServer(
new WsServer(
new ChatSocket()
)
),
8080
);
$server->run();
}
}
But running command in console I got error:
$ php artisan chat_server:serve
Start server!
PHP Fatal error: Interface 'RachetMessageComponentInterface' not found in /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php on line 7
SymfonyComponentDebugExceptionFatalErrorException : Interface 'RachetMessageComponentInterface' not found
at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
3|
4| use RachetMessageComponentInterface;
5| use RachetConnectionInterface;
6|
> 7| class BaseSocket implements MessageComponentInterface {
8|
9| public function onOpen(ConnectionInterface $conn) {
10|
11| }
WhoopsExceptionErrorException : Interface 'RachetMessageComponentInterface' not found
at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
3|
4| use RachetMessageComponentInterface;
5| use RachetConnectionInterface;
6|
> 7| class BaseSocket implements MessageComponentInterface {
8|
9| public function onOpen(ConnectionInterface $conn) {
10|
11| }
Did I miss some declarations or have I to add declarations to app.php ?
Reading docs I missed if I have add config declarations?
UPDATED BLOCK # 2:
Searching for decision I found an opinion, that I need to create my own service provider for it register it properly in Laravel
Which steps have I to do to create my own service provider for "cboden/ratchet" ? This is out of my laravel expierence...
Thanks!
laravel-5 socket.io ratchet
In my laravel 5.7 app I installed cboden/ratchet using some online docs
composer.json :
"type": "project",
"require": {
...
"cboden/ratchet": "^0.4.1",
With app/Classes/Socket/Base/BaseSocket.php :
<?php
namespace AppClassesSocketBase;
use RachetMessageComponentInterface;
use RachetConnectionInterface;
class BaseSocket implements MessageComponentInterface {
public function onOpen(ConnectionInterface $conn) {
}
public function onMessage(ConnectionInterface $conn, $mgs) {
}
public function onClose(ConnectionInterface $conn) {
}
public function onError(ConnectionInterface $conn, Exception $e) {
}
}
and console command app/Console/Commands/ChatServer.php :
<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use RatchetHttpHttpServer;
use RatchetServerIoServer;
use RatchetWebSocketWsServer;
use AppClassesSocketChatSocket;
class ChatServer extends Command
{
protected $signature = 'chat_server:serve';
protected $description = 'chat_server description';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$this->info("Start server!");
$server= IoServer::factory(
new HttpServer(
new WsServer(
new ChatSocket()
)
),
8080
);
$server->run();
}
}
But running command in console I got error:
$ php artisan chat_server:serve
Start server!
PHP Fatal error: Interface 'RachetMessageComponentInterface' not found in /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php on line 7
SymfonyComponentDebugExceptionFatalErrorException : Interface 'RachetMessageComponentInterface' not found
at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
3|
4| use RachetMessageComponentInterface;
5| use RachetConnectionInterface;
6|
> 7| class BaseSocket implements MessageComponentInterface {
8|
9| public function onOpen(ConnectionInterface $conn) {
10|
11| }
WhoopsExceptionErrorException : Interface 'RachetMessageComponentInterface' not found
at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
3|
4| use RachetMessageComponentInterface;
5| use RachetConnectionInterface;
6|
> 7| class BaseSocket implements MessageComponentInterface {
8|
9| public function onOpen(ConnectionInterface $conn) {
10|
11| }
Did I miss some declarations or have I to add declarations to app.php ?
Reading docs I missed if I have add config declarations?
UPDATED BLOCK # 2:
Searching for decision I found an opinion, that I need to create my own service provider for it register it properly in Laravel
Which steps have I to do to create my own service provider for "cboden/ratchet" ? This is out of my laravel expierence...
Thanks!
laravel-5 socket.io ratchet
laravel-5 socket.io ratchet
edited Nov 23 '18 at 7:08
asked Nov 21 '18 at 7:49
mstdmstd
168514
168514
Please look at UPDATED BLOCK # 2
– mstdmstd
Nov 23 '18 at 7:09
add a comment |
Please look at UPDATED BLOCK # 2
– mstdmstd
Nov 23 '18 at 7:09
Please look at UPDATED BLOCK # 2
– mstdmstd
Nov 23 '18 at 7:09
Please look at UPDATED BLOCK # 2
– mstdmstd
Nov 23 '18 at 7:09
add a comment |
1 Answer
1
active
oldest
votes
Looks like misspelling. Must be :
use RatchetMessageComponentInterface;
use RatchetConnectionInterface;
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407396%2fusing-cboden-ratchet-i-got-interface-rachet-messagecomponentinterface-not-foun%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Looks like misspelling. Must be :
use RatchetMessageComponentInterface;
use RatchetConnectionInterface;
add a comment |
Looks like misspelling. Must be :
use RatchetMessageComponentInterface;
use RatchetConnectionInterface;
add a comment |
Looks like misspelling. Must be :
use RatchetMessageComponentInterface;
use RatchetConnectionInterface;
Looks like misspelling. Must be :
use RatchetMessageComponentInterface;
use RatchetConnectionInterface;
answered Nov 24 '18 at 11:22
mstdmstd
622514
622514
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407396%2fusing-cboden-ratchet-i-got-interface-rachet-messagecomponentinterface-not-foun%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please look at UPDATED BLOCK # 2
– mstdmstd
Nov 23 '18 at 7:09