webrtc-rails 0.3.11 → 0.3.12
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4147f593226610ca34d19ffbecbc3277975ab36
|
4
|
+
data.tar.gz: 54d0d8c7d8e4f482f047b284f458195ad912cfbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80cbf33163749a6730e2fa55b51c72ee0ded9ba587ce2b40523835373a37822e8a647e757b7abc3b08eca20679e4b589728781990563186c87af150c6712c0e1
|
7
|
+
data.tar.gz: 18f211cc5cdc693b2c27bd9a084e118d268b02add33294a59ab2f64ca2d3567eb162a4bb0f4f87d34f4527f3915e371bbd55ec15a31f11e59a5b6d18a786102b
|
@@ -1,3 +1,7 @@
|
|
1
|
+
class @WebRTCHeartbeatUserInfo
|
2
|
+
value: 0
|
3
|
+
getValue: -> JSON.stringify(@value)
|
4
|
+
|
1
5
|
class @WebRTC
|
2
6
|
@DISCONNECTED: 0
|
3
7
|
@TIMEOUT: 1
|
@@ -19,6 +23,8 @@ class @WebRTC
|
|
19
23
|
onUserMessage: (sentUserIdentifier, event, message) ->
|
20
24
|
onSendUserMessageFailed: (sendUserIdentifier, event, message) ->
|
21
25
|
|
26
|
+
heartbeatUserInfo: new WebRTCHeartbeatUserInfo
|
27
|
+
|
22
28
|
constructor: (url, userToken, localOutput, remoteOutput) ->
|
23
29
|
@localOutput = if localOutput? then (localOutput[0] || localOutput) else null
|
24
30
|
@remoteOutput = remoteOutput[0] || remoteOutput
|
@@ -211,7 +217,9 @@ class @WebRTC
|
|
211
217
|
@_heartbeat()
|
212
218
|
|
213
219
|
_heartbeat: ->
|
214
|
-
@_sendValue('heartbeat',
|
220
|
+
@_sendValue('heartbeat',
|
221
|
+
userInfo: @heartbeatUserInfo.getValue()
|
222
|
+
)
|
215
223
|
window.setTimeout(
|
216
224
|
=>
|
217
225
|
@_heartbeat()
|
data/lib/webrtc_rails/daemon.rb
CHANGED
@@ -51,23 +51,26 @@ module WebrtcRails
|
|
51
51
|
|
52
52
|
websocket.onmessage do |message|
|
53
53
|
data = JSON.parse(message, {symbolize_names: true})
|
54
|
-
next if data[:event] == 'heartbeat'
|
55
54
|
token = data[:token]
|
56
55
|
next if token.blank?
|
57
56
|
user = @user_class.send(@fetch_user_by_token_method, token.to_s)
|
58
57
|
my_user_identifier = user ? user.send(@user_identifier).to_s : nil
|
59
|
-
|
58
|
+
event = data[:event]
|
59
|
+
next if my_user_identifier.blank? && event != 'heartbeat'
|
60
60
|
|
61
|
-
case
|
61
|
+
case event
|
62
|
+
when 'heartbeat'
|
63
|
+
user_info = data[:value][:userInfo]
|
64
|
+
@daemon_delegate.onWebSocketHeartbeated(my_user_identifier, user_info)
|
62
65
|
when 'userMessage'
|
63
66
|
user_identifier = data[:value][:userIdentifier]
|
64
|
-
|
67
|
+
event_value = data[:value][:event]
|
65
68
|
message = data[:value][:message]
|
66
|
-
if @daemon_delegate.onWantSendUserMessage(my_user_identifier, user_identifier,
|
69
|
+
if @daemon_delegate.onWantSendUserMessage(my_user_identifier, user_identifier, event_value, message)
|
67
70
|
message = {
|
68
71
|
type: 'userMessage',
|
69
72
|
remoteUserIdentifier: my_user_identifier,
|
70
|
-
event:
|
73
|
+
event: event_value,
|
71
74
|
message: message
|
72
75
|
}
|
73
76
|
sendMessage(user_identifier, message) do
|
data/lib/webrtc_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webrtc-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koji Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-websocket
|