Skip to content

Instantly share code, notes, and snippets.

@ammezie
Created November 13, 2019 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ammezie/ddff82db5faa3a3c24f5f44ed78079d5 to your computer and use it in GitHub Desktop.
Save ammezie/ddff82db5faa3a3c24f5f44ed78079d5 to your computer and use it in GitHub Desktop.
// app/Http/Controllers/ChatController.php
...
protected $client;
protected $channel;
public function __construct()
{
$this->client = new StreamClient(env("MIX_STREAM_API_KEY"), env("MIX_STREAM_API_SECRET"), null, null, 9);
$this->channel = $this->client->Channel("messaging", "chatroom");
}
public function leaveChannel(Request $request)
{
return $this->channel->removeMembers([$request->username]);
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment