Skip to content

Instantly share code, notes, and snippets.

@ammezie

ammezie/ChatController.php Secret

Created Sep 30, 2019
Embed
What would you like to do?
// app/http/Controllers/ChatController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use GetStream\StreamChat\Client as StreamClient;
class ChatController extends Controller
{
/**
* Generate token for clientside use
*/
public function generateToken(Request $request)
{
$client = new StreamClient(env("MIX_STREAM_API_KEY"), env("MIX_STREAM_API_SECRET"), null, null, 9);
return response()->json([
'token' => $client->createToken($request->user_id)
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.