Suggestions

close search

Room token

Room token is used on client side to perform join room, leave room

Create the JWT token (room_token) with format:

HEADER:
    {
        "typ": "JWT",
        "alg": "HS256",// only support HS256
        "cty": "stringee-api;v=1"
    }

PAYLOAD:
    {
        "jti": "SK...-...",//JWT ID
        "iss": "SK...",//API key sid
        "exp": ...,//expiration time
        "roomId": "room-...", //Your room id
        'permissions' => array(
            'publish' => true, // allow publish
            'subscribe' => true,//allow subcribe
            'control_room' => true, //allow control
        )
    }

VERIFY SIGNATURE:
    HMACSHA256(
        base64UrlEncode(HEADER) + "." +
        base64UrlEncode(PAYLOAD),
        apiKeySecret
    )

The values:

    iss: API key SID generated by Stringee 
    jti: the identify of the token, can be generated by: apiKeySid_timestamp
    exp: the expired time of the token (in second)
    apiKeySecret: API key secret generated by Stringee

Github sample:

https://github.com/stringeecom/web-sdk-conference-samples

Sample using roomToken to join room:

StringeeVideo.joinRoom(stringeeClient, roomToken).then(function (data) {
    console.log('+++ res joinRoom', data);
})