Comments (13)
Have you try to clear your browser cookie ?
from websocketbundle.
Yes I did, but I do not see the relevance between this particular problem and cookies, because every time I try to clear cache using php app/console cache:clear command, the same error occurs.
This procedure was valid for Symfony 2.5, at 2.6 they made change which allows for passing dsn as parameter in pdo session handler, and for some reason when I try to pass the PDO class to the handler, it tries to serialize and pass the instance, so I think the problem lies there. It would be best if you can come up with a solution which will allow us to use the recommended way as stated by Symfony to pass dsn as parameter to the handler, and still make the websocketbundle work.
from websocketbundle.
Yes I did, but I do not see the relevance between this particular problem and cookies
Because your PHPSESSID can refer to a old session, before that you setup PDOSessionHandler and may create some weird bug.
Here my config who work under symfony 2.7.X
parameters:
pdo.db_options:
db_table: sessions
lock_mode: 0
services:
pdo:
class: PDO
arguments:
dsn: mysql:host=%database_host%;port=%database_port%;dbname=%database_name%
user: %database_user%
password: %database_password%
calls:
- [ setAttribute, [3, 2] ] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION
session.handler.pdo:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
arguments: [@pdo, %pdo.db_options%]
Which version of Symfony are you using ?
By removing public: false
on session handler it work ?
from websocketbundle.
I am using Symfony 2.6.X
I removed public : false
, and set the parameters as you defined above, but still the error shows. It seems to be related to passing the PDO class to the session handler.
Again providing my config for your kind information
pdo:
class: PDO
arguments:
dsn: mysql:host=%database_host%;port=%database_port%;dbname=%database_name%
user: %database_user%
password: %database_password%
calls:
- [ setAttribute, [3, 2] ] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION
session.handler.pdo:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
arguments: [@pdo, {db_table: sessions, lock_mode : 0}]
from websocketbundle.
and the websocket bundle configuration is something like :
gos_web_socket:
client:
firewall: secured_area
session_handler: @session.handler.pdo
from websocketbundle.
Hello.
My config looks almost the same as here.
So i use session.handker.pdo.
But then when i run
$user = $this->clientManipulator->getClient($connection);
var_dump($user); die();
i expect see my currently authorized in user entity like if i receive it from token.
But i got
string(36) "anon-75600669455ddd1b87c298582826341"
So how can i get currently authorized user entity here?
Is it necessary to have redis client storage for this purpose?
Thank you
from websocketbundle.
Already found that it was incorrect domain in websocket host
from websocketbundle.
@Prophet777 my firewall's name is main
, here is my websocket configuration
gos_web_socket:
client:
session_handler: @session.handler.pdo
firewall: main # Example: secured_area, you must replace it by your firewall
shared_config: true
assetic: true #use assetic bundle
server:
host: "%websocket_host%" #The host ip to bind to
port: "%websocket_port%" #The port the socket server will listen on
router:
resources:
- @AppBundle/Resources/config/pubsub/routing.yml
pushers:
wamp:
host: "%websocket_host%"
port: "%websocket_port%"
The problem is unfortunately still showing. It's preventing me from starting on my projected plan, so it's really bothering me. Any kind of insight would be really helpful.
from websocketbundle.
Also, another thing - passing pdo as argument in session handler class is depreciated now in Symfony, so it would be best to come up with a solution where we can use websocket while passsing dsn only to the session handler.
from websocketbundle.
@faheem00 where did you see it's deprecated ???
from websocketbundle.
I think there was a miscommunication. By deprecated, I meant that passing pdo instance to the session handler is no longer recommended by the Symfony documentation, in their example they use the dsn string to pass to the session handler.
But yes, we can still use the pdo instance, but the problem here is what I am facing. I have set the settings as you exactly specified, but still I am shown the exception every time. Any way you can help?
from websocketbundle.
OK, you can still try by passing the dns as argument. My given example is not writen in marble :)
So if that work perfectly by passing dns, it's perfect. We just had to correct the docs.
I'm waiting your feedback if that work or not
Le 28 août 2015 07:54, Faheem Abrar [email protected] a écrit :I think there was a miscommunication. By deprecated, I meant that passing pdo instance to the session handler is no longer recommended by the Symfony documentation, in their example they use the dsn string to pass to the session handler.
But yes, we can still use the pdo instance, but the problem here is what I am facing. I have set the settings as you exactly specified, but still I am shown the exception every time. Any way you can help?
—Reply to this email directly or view it on GitHub.
from websocketbundle.
Passing dsn as argument was the first thing I tried. Here is the config:
session.handler.pdo:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
arguments:
- "mysql:dbname=%database_name%"
- { db_username: %database_user%, db_password: %database_password%, lock_mode : 0 }
Using this config, the server successfully starts, but when I browse a page on which I subscribed to a topic, the following error occurs:
PHP Fatal error: Call to a member function prepare() on a non-object in /var/www/tour/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php on line 511
on line 511 of the session handler is the following code:
$selectStmt = $this->pdo->prepare($selectSql);
My guess is that $this->pdo
does not have a pdo instance for some reason. I am also using the same session handler as my current session handler, and it works without any problem, the problem is happening to the Ratchet server.
from websocketbundle.
Related Issues (20)
- Connection auto closes right after first incomming message HOT 1
- Suggestion: Native TLS support HOT 5
- The service ".service_locator.VS38E50" has a dependency on a non-existent service "Gos\Bundle\WebSocketBundle\Pusher\Wamp\WampPusher". HOT 5
- How define route with parameter?
- After upgrading Symfony from 5.3.0 to 5.3.13, gos:wsb gives error when client attempts to subscribe to channel HOT 4
- Push Notifications from Server HOT 1
- Error using PdoSessionHandler with symfony 6 - "VirtualSessionStorage::start() must be compatible.." HOT 3
- Session Problem PDO HOT 5
- Error installing the bundle: Undefined array key "port" HOT 2
- Uncaught ReferenceError: GosSocket is not defined HOT 2
- Please provide documentation for using the symfony messenger component as a pusher HOT 2
- Update to support modern Autobahn version. HOT 8
- New authentication flow using JWT HOT 9
- Subscribe to topic on server HOT 2
- Connection in IPV6 HOT 1
- TopicPeriodicTimer doesn't see new connections
- TopicPeriodicTimer only registered for one Topic, wrongly cleared if any one Topic has zero connections HOT 1
- How can I send a message HOT 2
- error while installing (In GosWebSocketExtension.php line 276 Notice: Undefined index: port)
- The "Gos\Bundle\WebSocketBundle\Pusher\PusherRegistry" class is deprecated and will be removed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websocketbundle.