WebSocketBundle | Websocket server for Symfony applications | Websocket library
kandi X-RAY | WebSocketBundle Summary
kandi X-RAY | WebSocketBundle Summary
GosWebSocketBundle is a Symfony bundle built on top of Ratchet and Autobahn|JS designed to bring together websocket functionality in an easy-to-use application architecture.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- On client disconnect .
- Register the twig configuration .
- Handles client errors .
- Build the compiler .
- Handle client rejected event .
- Toggle timer
- Returns the timeout in seconds .
- Get directory path .
- Get the interval interval .
WebSocketBundle Key Features
WebSocketBundle Examples and Code Snippets
Community Discussions
Trending Discussions on WebSocketBundle
QUESTION
I'm new to Symfony and try to use the ClientManipulatorInterface service from gos/web-socket-bundle. My problem is that Symfony returns an error even if I configure the argument manually.
I always get this error: Cannot autowire service "Foo\Bar\Controller\testTopic": argument "$clientManipulator" of method "__construct()" references interface "Gos\Bundle\WebSocketBundle\Client\ClientManipulatorInterface" but no such service exists. You should maybe
alias this interface to the existing "gos_web_socket.websocket.client_manipulator" service.
Here is my service.yaml:
...ANSWER
Answered 2018-Oct-05 at 14:03You need to alias the ClientManipulatorInterface
to one of it's implementations for Symfony to be able to autowire the dependency correctly:
QUESTION
I'm building an application where I can see realtime changes within the logs This application is build with the Symfony v4.1. There is this bundle that has a Web Socket server and client based on Ratchet and Autobahn.js
I've setup all the requirements to make it work according to the documentation.
There's a Topic class:
pubsub routing is configured
The server runs
Client runs in javascript when page is loaded
The script to connect works fine, until I subscribe to a channel/topic. The connection is immediately closed on the client side, without the server detecting it. Does anyone know how to solve this? Also, I'm curious what this responsecode WS-1007 means.
Javascript:
...ANSWER
Answered 2018-Sep-13 at 12:19So, I've found the solution eventually, the topic needs to be tagged in your services configuration
services.yaml:
QUESTION
I have enabled the PDO Periodic Pings for GOS:WebSocketBundle, I'm still getting this error from time to time:
...ANSWER
Answered 2018-Apr-17 at 12:52Solved. Problem was that I defined periodic timer inside Topic inside "onSubscribe" funciton like:
QUESTION
Quite fascinating fact I just found out while messing up with WebSocket application I am now building using Symfony 4.1 and https://github.com/GeniusesOfSymfony/WebSocketBundle (which is built upon PHP Ratchet).
I wanted to fetch the newest data periodically from the MySQL database for testing purpose using $repository->find(2);
but it always returned the same result even though I was changing data while being subscribed to the WebSocket channel.
After quite a lot of hours of messing with the code and crying, I found out that for some reason Doctrine is caching results (or that is what I think it does).
To test my theory, I created a service that handles fetching from the database with the following code:
...ANSWER
Answered 2018-Jul-29 at 15:20I actually managed to figure this out myself.
Doctrine's EntityManager find(...)
method actually caches the result inside private field called $unitOfWork
under an entity's name and entry ID.
Every time you try to find something using $em->find(...)
and it succeeds, the result is being stored inside $this->unitOfWork
and if you try to fetch again the same thing it just loads from cache.
QUESTION
Context
I am new to websockets, and trying to implement a notifications pusher on Symfony with the help of the WebsocketBundle, following this tutorial.
The bundle is implementing 3 different pushers :
I tried using the zmq pusher and it just does not seem to fit with Windows (I am getting the exact same symptoms as in the linked post)
I then tried WebSocketPusher and when I run the WSServer the port I configured in
config.yml
is not even opening. Same symptom as this open issueSo, finally, I tried to use AMQP pusher and this time I cannot even install it, but as my google searches do not end up in github open issues, I think that I'm probably the one missing something here, and thus I'm posting here.
Problem
I installed the php extension and it does seem to work as it appears in my php extensions and does not give any errors.
When I run the following command from the tutorial : composer require gos/react-amqp
I am getting the following response :
ANSWER
Answered 2017-Aug-03 at 15:56Alright, so I finally got it working.
For some reason composer would keep using the 2.1.0 version when it was never required.
For those running into the same kind of composer error, here is what I did :
rm composer.lock
explicitely ask for the exact minimum required version, in my case :
composer require evenement/evenement:2.0
You should see something likeUpdating evenement/evenement (v2.1.0 => v2.0.0) Downloading: 100%
in the consolecomposer install
QUESTION
using GeniusesOfSymfony/WebSocketBundle with
...ANSWER
Answered 2017-Nov-15 at 06:41Okey, finally figured it out, as in documentation (took time to find it), you cannot use native session handlers with ratchet, all i had to do, was:
session_handler: "@session.handler.pdo"
and everything works as expected.
QUESTION
I'm implementing sockets on my app, so I did these steps:
Create the topic handler service, like this but with an Entity Manager on his
...__construct
method.
ANSWER
Answered 2017-Oct-27 at 10:08The problem was, that im using service.yml
when im in local enviroment and im not declared Entity Manager in my config_prod.yml
file.
So i solved creating the entity manager in all enviroments.
QUESTION
I'm using Dropwizard for a REST server and dropwizard-websocket-jee7-bundle to enable websockets.
For the websocket server I used this example.
Testing the websocket server standalone works fine, but in combination with Dropwizard, when a client tries to connect (to ws://localhost:port/actions) it gets a 500 Internal Server Error (Error log below).
I'm guessing there is some bad or missing configuration, but I can't figure our where.
ServerExample:
...ANSWER
Answered 2017-Sep-02 at 19:29Downgraded the dropwizard version I was using to the last reported version in the bundle (0.9.1) and this error is gone (although i have a null pointer exception now. will open a new question about that error).
QUESTION
I used this plugin GeniusesOfSymfony/WebSocketBundle to integrate websockets in my application.
However through the documentation I didn't find how to push data into the channel once we've subscribed to it, from outide the "socket/connect" event:
...ANSWER
Answered 2017-Jul-18 at 09:36I just had to create a global scope variable "sendMessage" and instantiate it with the nested function :
QUESTION
I'm working on a Symfony2 application with WebSocketBundle.
https://github.com/GeniusesOfSymfony/WebSocketBundle.
The installation of the bundle has been done successfully.
So, I run a websocket server (port 8080 in local) with simple command : "php app/console gos:websocket:server"
while my symfony server is running (port 8000 in local).
I setup a simple client javascript to use WebSocketBundle following official tutorial which is on the github of the bundle.
When I come to a page on my website, I am correctly connected to the websocket server.
The problem comes when I want to use functions subscribe() and publish() that allow a user to subscribe to a channel, when anybody publish something on this channel, the message is received by the subscriber.
In my case, the message is not sent or received, I don't really know why because no revelant error is shown, I tried to follow as accurately as possible the official tutorial here :
https://github.com/GeniusesOfSymfony/WebSocketBundle/blob/master/Resources/docs/TopicSetup.md
But, unfortunately, I can't manage to make this works. That's why I solicit you to help me.
I share you below the most revelant piece of code to show how the setup takes place :
Client JavaScript :
[/web/js/own_scripts/gws_lobby.js]
ANSWER
Answered 2017-Jan-13 at 09:48hi i write this post to give you another way to use websocket and symfony i have never use your aproche but i build many application using this tutorial if you find yourself stuck you can use it her
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install WebSocketBundle
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page