Skip to content

Commit

Permalink
added code and reason args to close()
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwdan committed Dec 5, 2018
1 parent 4911c72 commit db27802
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/WebSocketConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public function send($data)
$this->stream->write($data->getContents());
}

public function close()
public function close($code = 1000, $reason = '')
{
$this->stream->end((new Frame(pack('n', 1000), true, Frame::OP_CLOSE))->getContents());
$this->stream->end((new Frame(pack('n', $code) . $reason, true, Frame::OP_CLOSE))->getContents());
}
}

0 comments on commit db27802

Please sign in to comment.