wampproto 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +39 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/LICENSE +22 -0
  7. data/README.md +35 -0
  8. data/Rakefile +12 -0
  9. data/Steepfile +33 -0
  10. data/lib/wampproto/acceptor/authenticator.rb +14 -0
  11. data/lib/wampproto/acceptor/request.rb +58 -0
  12. data/lib/wampproto/acceptor/response.rb +19 -0
  13. data/lib/wampproto/acceptor.rb +183 -0
  14. data/lib/wampproto/auth/anonymous.rb +14 -0
  15. data/lib/wampproto/auth/base.rb +20 -0
  16. data/lib/wampproto/auth/cra.rb +84 -0
  17. data/lib/wampproto/auth/cryptosign.rb +86 -0
  18. data/lib/wampproto/auth/helpers.rb +25 -0
  19. data/lib/wampproto/auth/ticket.rb +27 -0
  20. data/lib/wampproto/auth.rb +14 -0
  21. data/lib/wampproto/broker.rb +155 -0
  22. data/lib/wampproto/dealer.rb +143 -0
  23. data/lib/wampproto/id_generator.rb +23 -0
  24. data/lib/wampproto/joiner.rb +78 -0
  25. data/lib/wampproto/message/abort.rb +32 -0
  26. data/lib/wampproto/message/authenticate.rb +25 -0
  27. data/lib/wampproto/message/base.rb +30 -0
  28. data/lib/wampproto/message/call.rb +33 -0
  29. data/lib/wampproto/message/challenge.rb +25 -0
  30. data/lib/wampproto/message/error.rb +27 -0
  31. data/lib/wampproto/message/event.rb +33 -0
  32. data/lib/wampproto/message/goodbye.rb +25 -0
  33. data/lib/wampproto/message/hello.rb +64 -0
  34. data/lib/wampproto/message/invocation.rb +33 -0
  35. data/lib/wampproto/message/publish.rb +33 -0
  36. data/lib/wampproto/message/published.rb +25 -0
  37. data/lib/wampproto/message/register.rb +26 -0
  38. data/lib/wampproto/message/registered.rb +25 -0
  39. data/lib/wampproto/message/result.rb +32 -0
  40. data/lib/wampproto/message/subscribe.rb +26 -0
  41. data/lib/wampproto/message/subscribed.rb +25 -0
  42. data/lib/wampproto/message/unregister.rb +25 -0
  43. data/lib/wampproto/message/unregistered.rb +24 -0
  44. data/lib/wampproto/message/unsubscribe.rb +25 -0
  45. data/lib/wampproto/message/unsubscribed.rb +24 -0
  46. data/lib/wampproto/message/welcome.rb +41 -0
  47. data/lib/wampproto/message/yield.rb +32 -0
  48. data/lib/wampproto/message.rb +108 -0
  49. data/lib/wampproto/message_with_recipient.rb +13 -0
  50. data/lib/wampproto/serializer/cbor.rb +18 -0
  51. data/lib/wampproto/serializer/json.rb +18 -0
  52. data/lib/wampproto/serializer/msgpack.rb +18 -0
  53. data/lib/wampproto/serializer.rb +5 -0
  54. data/lib/wampproto/session.rb +144 -0
  55. data/lib/wampproto/session_details.rb +24 -0
  56. data/lib/wampproto/validate.rb +52 -0
  57. data/lib/wampproto/version.rb +5 -0
  58. data/lib/wampproto.rb +32 -0
  59. data/sig/cbor.rbs +5 -0
  60. data/sig/ed25519/signing_key.rbs +7 -0
  61. data/sig/ed25519/verify_key.rbs +7 -0
  62. data/sig/message_pack.rbs +5 -0
  63. data/sig/wampproto/acceptor/authenticator.rbs +9 -0
  64. data/sig/wampproto/acceptor/request.rbs +46 -0
  65. data/sig/wampproto/acceptor/response.rbs +25 -0
  66. data/sig/wampproto/acceptor.rbs +86 -0
  67. data/sig/wampproto/auth/anonymous.rbs +13 -0
  68. data/sig/wampproto/auth/base.rbs +25 -0
  69. data/sig/wampproto/auth/cra.rbs +34 -0
  70. data/sig/wampproto/auth/cryptosign.rbs +38 -0
  71. data/sig/wampproto/auth/helpers.rbs +16 -0
  72. data/sig/wampproto/auth/ticket.rbs +21 -0
  73. data/sig/wampproto/broker.rbs +48 -0
  74. data/sig/wampproto/dealer.rbs +49 -0
  75. data/sig/wampproto/id_generator.rbs +17 -0
  76. data/sig/wampproto/joiner.rbs +43 -0
  77. data/sig/wampproto/message/abort.rbs +31 -0
  78. data/sig/wampproto/message/authenticate.rbs +20 -0
  79. data/sig/wampproto/message/base.rbs +14 -0
  80. data/sig/wampproto/message/call.rbs +34 -0
  81. data/sig/wampproto/message/challenge.rbs +20 -0
  82. data/sig/wampproto/message/error.rbs +28 -0
  83. data/sig/wampproto/message/event.rbs +34 -0
  84. data/sig/wampproto/message/goodbye.rbs +21 -0
  85. data/sig/wampproto/message/hello.rbs +39 -0
  86. data/sig/wampproto/message/invocation.rbs +34 -0
  87. data/sig/wampproto/message/publish.rbs +32 -0
  88. data/sig/wampproto/message/published.rbs +20 -0
  89. data/sig/wampproto/message/register.rbs +24 -0
  90. data/sig/wampproto/message/registered.rbs +20 -0
  91. data/sig/wampproto/message/result.rbs +32 -0
  92. data/sig/wampproto/message/subscribe.rbs +24 -0
  93. data/sig/wampproto/message/subscribed.rbs +20 -0
  94. data/sig/wampproto/message/unregister.rbs +20 -0
  95. data/sig/wampproto/message/unregistered.rbs +16 -0
  96. data/sig/wampproto/message/unsubscribe.rbs +20 -0
  97. data/sig/wampproto/message/unsubscribed.rbs +16 -0
  98. data/sig/wampproto/message/welcome.rbs +36 -0
  99. data/sig/wampproto/message/yield.rbs +30 -0
  100. data/sig/wampproto/message.rbs +59 -0
  101. data/sig/wampproto/message_with_recipient.rbs +15 -0
  102. data/sig/wampproto/serializer/cbor.rbs +10 -0
  103. data/sig/wampproto/serializer/json.rbs +11 -0
  104. data/sig/wampproto/serializer/msgpack.rbs +11 -0
  105. data/sig/wampproto/session.rbs +43 -0
  106. data/sig/wampproto/session_details.rbs +25 -0
  107. data/sig/wampproto/validate.rbs +18 -0
  108. data/sig/wampproto.rbs +17 -0
  109. data/wampproto.gemspec +39 -0
  110. metadata +196 -0
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # Wamp Challenge message
6
+ class Challenge < Base
7
+ attr_reader :auth_method, :extra
8
+
9
+ def initialize(auth_method, extra = {})
10
+ super()
11
+ @auth_method = Validate.string!("AuthMethod", auth_method)
12
+ @extra = Validate.hash!("Extra", extra)
13
+ end
14
+
15
+ def marshal
16
+ [Type::CHALLENGE, auth_method, extra]
17
+ end
18
+
19
+ def self.parse(wamp_message)
20
+ _type, auth_method, extra = wamp_message
21
+ new(auth_method, extra)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # abort message
6
+ class Error < Base
7
+ attr_reader :message_type, :request_id, :details, :error
8
+
9
+ def initialize(message_type, request_id, details, error)
10
+ super()
11
+ @message_type = Validate.int!("Message Type", message_type)
12
+ @request_id = Validate.int!("Request Id", request_id)
13
+ @details = Validate.hash!("Details", details)
14
+ @error = Validate.string!("Error", error)
15
+ end
16
+
17
+ def marshal
18
+ [Type::ERROR, message_type, request_id, details, error]
19
+ end
20
+
21
+ def self.parse(wamp_message)
22
+ _type, message_type, request_id, details, error = Validate.length!(wamp_message, 5)
23
+ new(message_type, request_id, details, error)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # event message
6
+ class Event < Base
7
+ attr_reader :subscription_id, :publication_id, :details, :args, :kwargs
8
+
9
+ def initialize(subscription_id, publication_id, details, *args, **kwargs)
10
+ super()
11
+ @subscription_id = Validate.int!("Subscription Id", subscription_id)
12
+ @publication_id = Validate.int!("Publication Id", publication_id)
13
+ @details = Validate.hash!("details", details)
14
+ @args = Validate.array!("Arguments", args)
15
+ @kwargs = Validate.hash!("Keyword Arguments", kwargs)
16
+ end
17
+
18
+ def marshal
19
+ @payload = [Type::EVENT, subscription_id, publication_id, details]
20
+ @payload << args if kwargs.any? || args.any?
21
+ @payload << kwargs if kwargs.any?
22
+ @payload
23
+ end
24
+
25
+ def self.parse(wamp_message)
26
+ _type, subscription_id, publication_id, details, args, kwargs = wamp_message
27
+ args ||= []
28
+ kwargs ||= {}
29
+ new(subscription_id, publication_id, details, *args, **kwargs)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # abort message
6
+ class Goodbye < Base
7
+ attr_reader :details, :reason
8
+
9
+ def initialize(details, reason)
10
+ super()
11
+ @details = Validate.hash!("Details", details)
12
+ @reason = Validate.string!("Reason", reason)
13
+ end
14
+
15
+ def marshal
16
+ [Type::GOODBYE, details, reason]
17
+ end
18
+
19
+ def self.parse(wamp_message)
20
+ _type, details, reason = Validate.greater_than_equal!(wamp_message, 3)
21
+ new(details, reason)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # Wamp Hello message
6
+ class Hello < Base
7
+ attr_reader :realm, :details
8
+
9
+ def initialize(realm, details = {})
10
+ super()
11
+ @realm = Validate.string!("Realm", realm)
12
+ @details = default_details.merge(parse_details(Validate.hash!("Details", details))).merge(additional_details)
13
+ end
14
+
15
+ def marshal
16
+ [Type::HELLO, @realm, @details]
17
+ end
18
+
19
+ def parse_details(hsh = {})
20
+ details = {}
21
+ details[:roles] = hsh.fetch(:roles, default_roles)
22
+ details[:authid] = hsh.fetch(:authid, nil)
23
+ details[:authmethods] = [*hsh.fetch(:authmethods, "anonymous")]
24
+ details[:authextra] = Validate.hash!("AuthExtra", hsh.fetch(:authextra)) if hsh[:authextra]
25
+ details
26
+ end
27
+
28
+ def self.parse(wamp_message)
29
+ _type, realm, details = wamp_message
30
+ new(realm, details)
31
+ end
32
+
33
+ def roles
34
+ @roles ||= details.fetch(:roles, {})
35
+ end
36
+
37
+ def authid
38
+ @authid ||= details[:authid]
39
+ end
40
+
41
+ def authmethods
42
+ @authmethods ||= details.fetch(:authmethods, [])
43
+ end
44
+
45
+ def authextra
46
+ @authextra ||= details.fetch(:authextra, {})
47
+ end
48
+
49
+ private
50
+
51
+ def default_details
52
+ { roles: default_roles }
53
+ end
54
+
55
+ def default_roles
56
+ { caller: {}, publisher: {}, subscriber: {}, callee: {} }
57
+ end
58
+
59
+ def additional_details
60
+ { agent: "Ruby-Wamp-Client-#{Wampproto::VERSION}" }
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # abort message
6
+ class Invocation < Base
7
+ attr_reader :request_id, :registration_id, :details, :args, :kwargs
8
+
9
+ def initialize(request_id, registration_id, details, *args, **kwargs)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @registration_id = Validate.int!("Registration Id", registration_id)
13
+ @details = Validate.hash!("Details", details)
14
+ @args = Validate.array!("Arguments", args)
15
+ @kwargs = Validate.hash!("Keyword Arguments", kwargs)
16
+ end
17
+
18
+ def marshal
19
+ @payload = [Type::INVOCATION, request_id, registration_id, details]
20
+ @payload << args if kwargs.any? || args.any?
21
+ @payload << kwargs if kwargs.any?
22
+ @payload
23
+ end
24
+
25
+ def self.parse(wamp_message)
26
+ _type, request_id, registration_id, details, args, kwargs = wamp_message
27
+ args ||= []
28
+ kwargs ||= {}
29
+ new(request_id, registration_id, details, *args, **kwargs)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # publish message
6
+ class Publish < Base
7
+ attr_reader :request_id, :options, :topic, :args, :kwargs
8
+
9
+ def initialize(request_id, options, topic, *args, **kwargs)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @options = Validate.hash!("Options", options)
13
+ @topic = Validate.string!("Topic", topic)
14
+ @args = Validate.array!("Arguments", args)
15
+ @kwargs = Validate.hash!("Keyword Arguments", kwargs)
16
+ end
17
+
18
+ def marshal
19
+ @payload = [Type::PUBLISH, request_id, options, topic]
20
+ @payload << args if kwargs.any? || args.any?
21
+ @payload << kwargs if kwargs.any?
22
+ @payload
23
+ end
24
+
25
+ def self.parse(wamp_message)
26
+ _type, request_id, options, topic, args, kwargs = wamp_message
27
+ args ||= []
28
+ kwargs ||= {}
29
+ new(request_id, options, topic, *args, **kwargs)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # published message
6
+ class Published < Base
7
+ attr_reader :request_id, :publication_id
8
+
9
+ def initialize(request_id, publication_id)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @publication_id = Validate.int!("Publication Id", publication_id)
13
+ end
14
+
15
+ def marshal
16
+ [Type::PUBLISHED, request_id, publication_id]
17
+ end
18
+
19
+ def self.parse(wamp_message)
20
+ _type, request_id, publication_id = Validate.length!(wamp_message, 3)
21
+ new(request_id, publication_id)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # publish message
6
+ class Register < Base
7
+ attr_reader :request_id, :options, :procedure
8
+
9
+ def initialize(request_id, options, procedure)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @options = Validate.hash!("Options", options)
13
+ @procedure = Validate.string!("Procedure", procedure)
14
+ end
15
+
16
+ def marshal
17
+ [Type::REGISTER, request_id, options, procedure]
18
+ end
19
+
20
+ def self.parse(wamp_message)
21
+ _type, request_id, options, procedure = wamp_message
22
+ new(request_id, options, procedure)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # publish message
6
+ class Registered < Base
7
+ attr_reader :request_id, :registration_id
8
+
9
+ def initialize(request_id, registration_id)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @registration_id = Validate.int!("Registration Id", registration_id)
13
+ end
14
+
15
+ def marshal
16
+ [Type::REGISTERED, request_id, registration_id]
17
+ end
18
+
19
+ def self.parse(wamp_message)
20
+ _type, request_id, registration_id = wamp_message
21
+ new(request_id, registration_id)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # wamp call message
6
+ class Result < Base
7
+ attr_reader :request_id, :details, :procedure, :args, :kwargs
8
+
9
+ def initialize(request_id, details, *args, **kwargs)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @details = Validate.hash!("Details", details)
13
+ @args = Validate.array!("Arguments", args)
14
+ @kwargs = Validate.hash!("Keyword Arguments", kwargs)
15
+ end
16
+
17
+ def marshal
18
+ @payload = [Type::RESULT, request_id, details]
19
+ @payload << args if kwargs.any? || args.any?
20
+ @payload << kwargs if kwargs.any?
21
+ @payload
22
+ end
23
+
24
+ def self.parse(wamp_message)
25
+ _type, request_id, details, args, kwargs = wamp_message
26
+ args ||= []
27
+ kwargs ||= {}
28
+ new(request_id, details, *args, **kwargs)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # abort message
6
+ class Subscribe < Base
7
+ attr_reader :request_id, :options, :topic
8
+
9
+ def initialize(request_id, options, topic)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @options = Validate.hash!("Options", options)
13
+ @topic = Validate.string!("Topic", topic)
14
+ end
15
+
16
+ def marshal
17
+ [Type::SUBSCRIBE, request_id, options, topic]
18
+ end
19
+
20
+ def self.parse(wamp_message)
21
+ _type, request_id, options, topic = wamp_message
22
+ new(request_id, options, topic)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # abort message
6
+ class Subscribed < Base
7
+ attr_reader :request_id, :subscription_id
8
+
9
+ def initialize(request_id, subscription_id)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @subscription_id = Validate.int!("Subscription Id", subscription_id)
13
+ end
14
+
15
+ def marshal
16
+ [Type::SUBSCRIBED, request_id, subscription_id]
17
+ end
18
+
19
+ def self.parse(wamp_message)
20
+ _type, request_id, subscription_id = Validate.length!(wamp_message, 3)
21
+ new(request_id, subscription_id)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # unregister message
6
+ class Unregister < Base
7
+ attr_reader :request_id, :registration_id
8
+
9
+ def initialize(request_id, registration_id)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @registration_id = Validate.int!("Registration Id", registration_id)
13
+ end
14
+
15
+ def marshal
16
+ [Type::UNREGISTER, request_id, registration_id]
17
+ end
18
+
19
+ def self.parse(wamp_message)
20
+ _type, request_id, registration_id = wamp_message
21
+ new(request_id, registration_id)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # unregistered message
6
+ class Unregistered < Base
7
+ attr_reader :request_id
8
+
9
+ def initialize(request_id)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ end
13
+
14
+ def marshal
15
+ [Type::UNREGISTERED, request_id]
16
+ end
17
+
18
+ def self.parse(wamp_message)
19
+ _type, request_id = wamp_message
20
+ new(request_id)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # abort message
6
+ class Unsubscribe < Base
7
+ attr_reader :request_id, :subscription_id
8
+
9
+ def initialize(request_id, subscription_id)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @subscription_id = Validate.int!("Subscription Id", subscription_id)
13
+ end
14
+
15
+ def marshal
16
+ [Type::UNSUBSCRIBE, request_id, subscription_id]
17
+ end
18
+
19
+ def self.parse(wamp_message)
20
+ _type, request_id, subscription_id = Validate.length!(wamp_message, 3)
21
+ new(request_id, subscription_id)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # Unsubscribed message
6
+ class Unsubscribed < Base
7
+ attr_reader :request_id
8
+
9
+ def initialize(request_id)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ end
13
+
14
+ def marshal
15
+ [Type::UNSUBSCRIBED, request_id]
16
+ end
17
+
18
+ def self.parse(wamp_message)
19
+ _type, request_id = Validate.length!(wamp_message, 2)
20
+ new(request_id)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # welcome message
6
+ class Welcome < Base
7
+ attr_reader :session_id, :details
8
+
9
+ def initialize(session_id, details = {})
10
+ super()
11
+ @session_id = Validate.int!("Session Id", session_id)
12
+ @details = Validate.hash!("Details", details)
13
+ end
14
+
15
+ def marshal
16
+ [Type::WELCOME, @session_id, @details]
17
+ end
18
+
19
+ def authrole
20
+ @authrole ||= details.fetch(:authrole, [])
21
+ end
22
+
23
+ def authid
24
+ @authid ||= details[:authid]
25
+ end
26
+
27
+ def authmethod
28
+ @authmethod ||= details[:authmethod]
29
+ end
30
+
31
+ def authextra
32
+ @authextra ||= details.fetch(:authextra) if details.member?(:authextra)
33
+ end
34
+
35
+ def self.parse(wamp_message)
36
+ _type, session_id, details = wamp_message
37
+ new(session_id, details)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wampproto
4
+ module Message
5
+ # yield message
6
+ class Yield < Base
7
+ attr_reader :request_id, :options, :args, :kwargs
8
+
9
+ def initialize(request_id, options, *args, **kwargs)
10
+ super()
11
+ @request_id = Validate.int!("Request Id", request_id)
12
+ @options = Validate.hash!("Options", options)
13
+ @args = Validate.array!("Arguments", args)
14
+ @kwargs = Validate.hash!("Keyword Arguments", kwargs)
15
+ end
16
+
17
+ def marshal
18
+ @payload = [Type::YIELD, request_id, options]
19
+ @payload << args if kwargs.any? || args.any?
20
+ @payload << kwargs if kwargs.any?
21
+ @payload
22
+ end
23
+
24
+ def self.parse(wamp_message)
25
+ _type, request_id, options, args, kwargs = wamp_message
26
+ args ||= []
27
+ kwargs ||= {}
28
+ new(request_id, options, *args, **kwargs)
29
+ end
30
+ end
31
+ end
32
+ end