{"action":"opened","issue":{"url":"https://api.github.com/repos/swoft-cloud/swoft/issues/303","repository_url":"https://api.github.com/repos/swoft-cloud/swoft","labels_url":"https://api.github.com/repos/swoft-cloud/swoft/issues/303/labels{/name}","comments_url":"https://api.github.com/repos/swoft-cloud/swoft/issues/303/comments","events_url":"https://api.github.com/repos/swoft-cloud/swoft/issues/303/events","html_url":"https://github.com/swoft-cloud/swoft/issues/303","id":338206725,"node_id":"MDU6SXNzdWUzMzgyMDY3MjU=","number":303,"title":"如何在websocket的控制器中使用session?","user":{"login":"JOSEFAzyq","id":18478972,"node_id":"MDQ6VXNlcjE4NDc4OTcy","avatar_url":"https://avatars3.githubusercontent.com/u/18478972?v=4","gravatar_id":"","url":"https://api.github.com/users/JOSEFAzyq","html_url":"https://github.com/JOSEFAzyq","followers_url":"https://api.github.com/users/JOSEFAzyq/followers","following_url":"https://api.github.com/users/JOSEFAzyq/following{/other_user}","gists_url":"https://api.github.com/users/JOSEFAzyq/gists{/gist_id}","starred_url":"https://api.github.com/users/JOSEFAzyq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JOSEFAzyq/subscriptions","organizations_url":"https://api.github.com/users/JOSEFAzyq/orgs","repos_url":"https://api.github.com/users/JOSEFAzyq/repos","events_url":"https://api.github.com/users/JOSEFAzyq/events{/privacy}","received_events_url":"https://api.github.com/users/JOSEFAzyq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-04T09:49:33Z","updated_at":"2018-07-04T09:49:33Z","closed_at":null,"author_association":"NONE","body":"| Q                   | A\r\n| ------------------- | -----\r\n| Bug report?         | no\r\n| Feature request?    | yes\r\n| Swoft version       | x.y.z\r\n| Swoole version      | 2.2\r\n| PHP version         | 7.1\r\n| Runtime environment | Win10/Mac/CentOS 7/Ubuntu/Docker etc.\r\n\r\n**Details**\r\n\r\n在httpcontroller下可以正常使用session()\r\n但是在websocket下使用session()则报\r\n\r\nPHP Fatal error:  Uncaught TypeError: Return value of Swoft\\Session\\SessionManager::getSession() must implement interface Swoft\\Session\\SessionInterface, null returned in /Applications/MAMP/htdocs/swoft/vendor/swoft/session/src/SessionManager.php:102\r\n\r\n```php\r\nPHP Fatal error:  Uncaught TypeError: Return value of Swoft\\Session\\SessionManager::getSession() must implement interface Swoft\\Session\\SessionInterface, null returned in /Applications/MAMP/htdocs/swoft/vendor/swoft/session/src/SessionManager.php:102\r\nStack trace:\r\n#0 /Applications/MAMP/htdocs/swoft/vendor/swoft/framework/src/Aop/Aop.php(57): Swoft\\Session\\SessionManager->getSession()\r\n#1 /Applications/MAMP/htdocs/swoft/vendor/swoft/framework/src/Proxy/Handler/AopHandler.php(43): Swoft\\Aop\\Aop->execute(Object(Swoft\\Session\\SessionManager), 'getSession', Array)\r\n#2 /Applications/MAMP/htdocs/swoft/vendor/swoft/framework/src/Proxy/Proxy.php(44) : eval()'d code(23): Swoft\\Proxy\\Handler\\AopHandler->invoke('getSession', Array)\r\n#3 /Applications/MAMP/htdocs/swoft/vendor/swoft/session/src/Helper/Functions.php(12): SessionManager_5b3c9783a3f40->getSession()\r\n#4 /Applications/MAMP/htdocs/swoft/app/WebSocket/EchoController.php(39): session()\r\n#5 /Applications/MAMP/htdocs/swoft/vendor/swoft/framework/src/Aop\r\n```\r\n\r\n"}}
{"actor":{"display_login":"JOSEFAzyq"}}