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: be24d47fe4e296985fa163e55792456b3b95f270
4
- data.tar.gz: 6a621ff3885d1241bb2b5ab13ae60ad32d03ea18
3
+ metadata.gz: c4147f593226610ca34d19ffbecbc3277975ab36
4
+ data.tar.gz: 54d0d8c7d8e4f482f047b284f458195ad912cfbd
5
5
  SHA512:
6
- metadata.gz: 362fdb4b8bcc3aca24e5d967bf60ebc9d32bb476cb54b3d075d96ba54e77bb16f690fda609a73c198e0976862d5026872a352f32a21ab936520343bd73a59250
7
- data.tar.gz: 71c64c555c991356f318faffde070663d9d0f5cd2e144f612fd5284d295fe8223348d1cec549936ed3666c866bf5a8c0636c29f853ea8c7f0f0e385ac40d73ae
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', null)
220
+ @_sendValue('heartbeat',
221
+ userInfo: @heartbeatUserInfo.getValue()
222
+ )
215
223
  window.setTimeout(
216
224
  =>
217
225
  @_heartbeat()
@@ -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
- next if my_user_identifier.blank?
58
+ event = data[:event]
59
+ next if my_user_identifier.blank? && event != 'heartbeat'
60
60
 
61
- case data[:event]
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
- event = data[:value][:event]
67
+ event_value = data[:value][:event]
65
68
  message = data[:value][:message]
66
- if @daemon_delegate.onWantSendUserMessage(my_user_identifier, user_identifier, event, message)
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: event,
73
+ event: event_value,
71
74
  message: message
72
75
  }
73
76
  sendMessage(user_identifier, message) do
@@ -1,5 +1,9 @@
1
1
  module WebrtcRails
2
2
  class DaemonDelegate
3
+ def onWebSocketHeartbeated(user_identifier, user_info)
4
+
5
+ end
6
+
3
7
  def onWebSocketConnected(user_identifier)
4
8
 
5
9
  end
@@ -1,3 +1,3 @@
1
1
  module WebrtcRails
2
- VERSION = "0.3.11"
2
+ VERSION = "0.3.12"
3
3
  end
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.11
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-04 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-websocket