walkor / walkor/workerman

How to retrieve cookie from $request parametr if it's a string?

Open
#954 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
11.6k
Forks
2.2k
Avg merge
11h 30m
Merged PRs (30d)
3

Description

I have this example
```
$this->worker = new Worker('websocket://0.0.0.0:8090', $this->context);
$this->worker->name = 'websocket';
$this->worker->count = 1;
$this->worker->transport = 'ssl';

$this->worker->onConnect = function($connection) {
$connection->onWebSocketConnect = function ($connection, $request) {
$connection->send($request);
};
};
```
And when i'm trying to use any method on $request like ```$request->cookie()``` i keep getting error like "Error: Call to a member function cookie() on string". Is there a build in parser for request or do i need to handle it myself?
When i worked with SSE, $request seems to be normal (not string).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the WebSocket onWebSocketConnect callback and the code or documentation that defines the $request argument for Worker. Determine why it is a string in this example while SSE provides a request object, then document or correct the expected cookie-access behavior and verify it with the relevant WebSocket flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.