# Including dependencies of Ratchet Websocket

**URL:** <https://discourse.cakephp.org/t/including-dependencies-of-ratchet-websocket/10755>\
**Category:** Need Help\
**Created:** [November 12, 2022, 5:57pm UTC](https://discourse.cakephp.org/t/including-dependencies-of-ratchet-websocket/10755 "2022-11-12T17:57:55Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Herzberg](https://avatars.discourse-cdn.com/v4/letter/h/74df32/32.png) [@Herzberg](https://discourse.cakephp.org/u/Herzberg)\
**Post date:** [November 12, 2022, 7:40pm UTC](https://discourse.cakephp.org/t/including-dependencies-of-ratchet-websocket/10755/5 "2022-11-12T19:40:26Z")

</div>

well i got it just here from the forum:

> [@How to save data realtime when run websocket by ratchet](https://discourse.cakephp.org/t/how-to-save-data-realtime-when-run-websocket-by-ratchet/9581):
>
> I create chat realtime with ratchet. I can sent realtime messages to clients, but when I want save data on Function onMessage(), it has errors. class WebsocketController extends AppController implements MessageComponentInterface Function onMessage(): public function onMessage(ConnectionInterface $from, $msg) { $numRecv = count($this-\>clients) - 1; $data = json\_decode($msg, true); echo sprintf('Connection %d sending message "%s" to %d other connection%s' . …

for them its working!

---

_[View the full topic](https://discourse.cakephp.org/t/including-dependencies-of-ratchet-websocket/10755)._
