Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close connection from server-side #20

Closed
clarkk opened this issue Aug 30, 2018 · 1 comment
Closed

Close connection from server-side #20

clarkk opened this issue Aug 30, 2018 · 1 comment

Comments

@clarkk
Copy link

clarkk commented Aug 30, 2018

If you close the connection from the ServerHandler you get an error

	public function onMessage(ConnectionContract $conn, $msg){
		$socket_id 		= $conn->getUniqueSocketId();
		$json 			= json_decode($msg, true);
		
		if(empty($json['sid'])){
			$conn->close();
		}
	}

error

fwrite(): supplied resource is not a valid stream resource /var/www/.../php/class/third-party/php-wss/Components/Connection.php(41)
#0 [internal function]: {closure}(2, 'fwrite(): suppl...', '/var/www/...', 41, Array)
#1 /var/www/.../php/class/third-party/php-wss/Components/Connection.php(41): fwrite(Resource id #31, '\x81={"sid":"k0krg...')
#2 /var/www/.../php/class/Websocket.php(82): WSSC\Components\Connection->send('{"sid":"k0krggq...')
#3 /var/www/.../php/class/third-party/php-wss/WebSocketServer.php(215): ServerHandler->onMessage(Object(WSSC\Components\Connection), '{"sid":"k0krggq...')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants