livekit-server-sdk 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -4
- data/README.md +57 -21
- data/lib/livekit/room_service_client.rb +1 -3
- data/lib/livekit/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77f26a584a937bc38b3d303925f5e5119afa710751c98cc3e66daef682486635
|
4
|
+
data.tar.gz: 6ef059111dbb04ba75c79dd753247b90cd18b636c060199c1e96e538e892c2ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80e8d8ce2fe6abbd2b7ea150ea2c6d0a5072713d47c554df5fc377724e2b5225efc436ea4a6e5c6c1b5b8e3e7363b5468433952562ec17bc64033a828776a989
|
7
|
+
data.tar.gz: dd0e0edf976ce497fd07ea0aa315608099fa026ac3a7fddb798df1ad90c7f75dd0623a978fc0be7018d1ddc837db3805733a911dc1f755996c922a9cb8f81acf
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
livekit-server-sdk (0.2.
|
4
|
+
livekit-server-sdk (0.2.2)
|
5
5
|
google-protobuf (~> 3.19.2)
|
6
6
|
jwt (~> 2.2.3)
|
7
7
|
twirp (~> 1.9.0)
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
coderay (1.1.3)
|
13
13
|
diff-lcs (1.4.4)
|
14
|
-
faraday (1.
|
14
|
+
faraday (1.10.0)
|
15
15
|
faraday-em_http (~> 1.0)
|
16
16
|
faraday-em_synchrony (~> 1.0)
|
17
17
|
faraday-excon (~> 1.1)
|
@@ -34,8 +34,7 @@ GEM
|
|
34
34
|
faraday-patron (1.0.0)
|
35
35
|
faraday-rack (1.0.0)
|
36
36
|
faraday-retry (1.0.3)
|
37
|
-
google-protobuf (3.19.
|
38
|
-
google-protobuf (3.19.2-x86_64-linux)
|
37
|
+
google-protobuf (3.19.4)
|
39
38
|
jwt (2.2.3)
|
40
39
|
method_source (1.0.0)
|
41
40
|
multipart-post (2.1.1)
|
data/README.md
CHANGED
@@ -1,45 +1,81 @@
|
|
1
|
-
|
1
|
+
# LiveKit Server API for Ruby
|
2
2
|
|
3
|
-
|
3
|
+
Ruby API for server-side integrations with LiveKit. This gem provides the ability to create access tokens as well as access RoomService.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
TODO: Delete this and the text above, and describe your gem
|
5
|
+
This library is designed to work with Ruby 2.6.0 and above.
|
8
6
|
|
9
7
|
## Installation
|
10
8
|
|
11
9
|
Add this line to your application's Gemfile:
|
12
10
|
|
11
|
+
### Gemfile
|
12
|
+
|
13
13
|
```ruby
|
14
|
-
gem 'livekit-
|
14
|
+
gem 'livekit-server-sdk'
|
15
15
|
```
|
16
16
|
|
17
|
-
|
17
|
+
and then `bundle install`.
|
18
18
|
|
19
|
-
|
19
|
+
### Install system-wide
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
```shell
|
22
|
+
gem install livekit-server-sdk
|
23
|
+
```
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
|
27
|
+
### Creating Access Tokens
|
28
28
|
|
29
|
-
|
29
|
+
Creating a token for participant to join a room.
|
30
30
|
|
31
|
-
|
31
|
+
```ruby
|
32
|
+
require 'livekit'
|
32
33
|
|
33
|
-
|
34
|
+
token = LiveKit::AccessToken.new(api_key: 'yourkey', api_secret: 'yoursecret')
|
35
|
+
token.identity = 'participant-identity'
|
36
|
+
token.name = 'participant-name'
|
37
|
+
token.add_grant(roomJoin: true, room: 'room-name')
|
34
38
|
|
35
|
-
|
39
|
+
puts token.to_jwt
|
40
|
+
```
|
36
41
|
|
37
|
-
|
42
|
+
By default, a token expires after 6 hours. You may override this by passing in `ttl` when creating the token. `ttl` is expressed in seconds.
|
38
43
|
|
39
|
-
|
44
|
+
### Setting Permissions with Access Tokens
|
40
45
|
|
41
|
-
|
46
|
+
It's possible to customize the permissions of each participant. See more details at [access tokens guide](https://docs.livekit.io/guides/access-tokens#room-permissions).
|
47
|
+
|
48
|
+
### Room Service
|
49
|
+
|
50
|
+
`RoomServiceClient` is a Twirp-based client that provides management APIs to LiveKit. You can connect it to your LiveKit endpoint. See [service apis](https://docs.livekit.io/guides/server-api) for a list of available APIs.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
require 'livekit'
|
54
|
+
|
55
|
+
client = LiveKit::RoomServiceClient.new('https://my.livekit.instance',
|
56
|
+
api_key: 'yourkey', api_secret: 'yoursecret')
|
42
57
|
|
43
|
-
|
58
|
+
name = 'myroom'
|
44
59
|
|
45
|
-
|
60
|
+
client.list_rooms
|
61
|
+
|
62
|
+
client.list_participants(room: name)
|
63
|
+
|
64
|
+
client.mute_published_track(room: name, identity: 'participant',
|
65
|
+
track_sid: 'track-id', muted: true)
|
66
|
+
|
67
|
+
client.remove_participant(room: name, identity: 'participant')
|
68
|
+
|
69
|
+
client.delete_room(room: name)
|
70
|
+
```
|
71
|
+
|
72
|
+
### Environment Variables
|
73
|
+
|
74
|
+
You may store credentials in environment variables. If api-key or api-secret is not passed in when creating a `RoomServiceClient` or `AccessToken`, the values in the following env vars will be used:
|
75
|
+
|
76
|
+
- `LIVEKIT_API_KEY`
|
77
|
+
- `LIVEKIT_API_SECRET`
|
78
|
+
|
79
|
+
## License
|
80
|
+
|
81
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -13,16 +13,14 @@ module LiveKit
|
|
13
13
|
@api_secret = api_secret
|
14
14
|
end
|
15
15
|
|
16
|
-
# creates a new room with name
|
17
16
|
def create_room(name, empty_timeout: nil, max_participants: nil)
|
18
17
|
self.rpc(
|
19
18
|
:CreateRoom,
|
20
|
-
Proto::
|
19
|
+
Proto::CreateRoomRequest.new(name: name, empty_timeout: empty_timeout, max_participants: max_participants),
|
21
20
|
headers: auth_header(roomCreate: true),
|
22
21
|
)
|
23
22
|
end
|
24
23
|
|
25
|
-
# Lists rooms, when names is set, only list matching rooms
|
26
24
|
def list_rooms(names: nil)
|
27
25
|
self.rpc(
|
28
26
|
:ListRooms,
|
data/lib/livekit/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: livekit-server-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Omri Gabay
|
8
8
|
- David Zhao
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-protobuf
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.9.0
|
56
|
-
description:
|
56
|
+
description:
|
57
57
|
email:
|
58
58
|
- omri@omrigabay.me
|
59
59
|
- dz@livekit.io
|
@@ -113,7 +113,7 @@ homepage: https://livekit.io
|
|
113
113
|
licenses:
|
114
114
|
- MIT
|
115
115
|
metadata: {}
|
116
|
-
post_install_message:
|
116
|
+
post_install_message:
|
117
117
|
rdoc_options: []
|
118
118
|
require_paths:
|
119
119
|
- lib
|
@@ -128,8 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
132
|
-
signing_key:
|
131
|
+
rubygems_version: 3.3.11
|
132
|
+
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: LiveKit Server SDK for Ruby
|
135
135
|
test_files: []
|