omq 0.26.2 → 0.27.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2c1793056ec0f8ed585034cf19a939a7bb22278d865dc9f570a2117e1bd45d4
4
- data.tar.gz: b8502a9780715a9e565b52b987ad1a698c07ff76c08c1a6e38f01b833b724f71
3
+ metadata.gz: 304adcf07ab3967251a821578bb96376b7c080e2a4d0d16430768ba6855b3557
4
+ data.tar.gz: 26babe478d3f2f07f8d011b2484083bc1c327a9938eaae0ab199bcdc560eaf55
5
5
  SHA512:
6
- metadata.gz: f3cbc43a10f74f0c1a872071871b9d5daddae41f2304823f8b57388a5c0c99cfb52e9a4118d9504c462d609af759c86a290d3235867fa5d22d46b9ffda63203c
7
- data.tar.gz: 44ca650e5c321a56fd4649cbebe0a4bd60efc3127547a5da0010582ed0fbb42fe4bcbf705ddfbf44596266a1d37869d49d4bef03df08551b703091d733b4e10f
6
+ metadata.gz: 873f2817de7d8fb063da6b425982493012b4eff08b3035cf86fbce948e3398de34ca319713dc4b1f56e4556250a82b23510a304e5f3a503aa01b367c5e6c6379
7
+ data.tar.gz: 18df1029acefe76806a1e188e077aad0023ec52a5ae63b31aac09fbe450aec68c4c4688b88b8ae77c19669a30f53c418b65f9a728eb377562a5c74da34e1a8fd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.27.0 — 2026-04-20
4
+
5
+ ### Added
6
+
7
+ - **Transport-supplied ZMTP Connection class.** Transport modules may
8
+ now define `.connection_class` to substitute their own
9
+ `Protocol::ZMTP::Connection`-shaped class. `ConnectionLifecycle`
10
+ reads it (with a `respond_to?` fallback to
11
+ `Protocol::ZMTP::Connection`) so existing transports — built-in or
12
+ third-party — keep working unchanged. Enables plugin transports
13
+ whose wire shape differs from ZMTP/3.1 (e.g. ZeroMQ-over-WebSocket
14
+ per RFC 45) to plug in without forking the engine.
15
+
3
16
  ## 0.26.2 — 2026-04-20
4
17
 
5
18
  ### Fixed
@@ -66,13 +66,19 @@ module OMQ
66
66
  # @param engine [Engine]
67
67
  # @param endpoint [String, nil]
68
68
  # @param done [Async::Promise, nil] resolved when connection is lost
69
+ # @param transport [Module, nil] transport module that produced +io+;
70
+ # queried for {.connection_class} so plugins (e.g. WebSocket) can
71
+ # substitute their own ZMTP-shaped connection class. Falls back to
72
+ # {Protocol::ZMTP::Connection} when nil or when the transport
73
+ # doesn't define +connection_class+.
69
74
  #
70
- def initialize(engine, endpoint: nil, done: nil)
71
- @engine = engine
72
- @endpoint = endpoint
73
- @done = done
74
- @state = :new
75
- @conn = nil
75
+ def initialize(engine, endpoint: nil, done: nil, transport: nil)
76
+ @engine = engine
77
+ @endpoint = endpoint
78
+ @done = done
79
+ @transport = transport
80
+ @state = :new
81
+ @conn = nil
76
82
 
77
83
  # Nest the per-connection barrier under the socket-level barrier
78
84
  # so every pump spawned via +@barrier.async+ is also tracked by
@@ -90,7 +96,8 @@ module OMQ
90
96
  #
91
97
  def handshake!(io, as_server:)
92
98
  transition!(:handshaking)
93
- conn = Protocol::ZMTP::Connection.new io,
99
+ conn_class = @transport.respond_to?(:connection_class) ? @transport.connection_class : Protocol::ZMTP::Connection
100
+ conn = conn_class.new io,
94
101
  socket_type: @engine.socket_type.to_s,
95
102
  identity: @engine.options.identity,
96
103
  as_server: as_server,
data/lib/omq/engine.rb CHANGED
@@ -635,7 +635,8 @@ module OMQ
635
635
  def spawn_connection(io, as_server:, endpoint: nil)
636
636
  @lifecycle.barrier&.async(transient: true, annotation: "conn #{endpoint}") do
637
637
  done = Async::Promise.new
638
- lifecycle = ConnectionLifecycle.new(self, endpoint: endpoint, done: done)
638
+ transport = endpoint ? transport_for(endpoint) : nil
639
+ lifecycle = ConnectionLifecycle.new(self, endpoint: endpoint, done: done, transport: transport)
639
640
  lifecycle.handshake!(io, as_server: as_server)
640
641
  done.wait
641
642
  rescue Async::Stop, Async::Cancel
@@ -15,6 +15,15 @@ module OMQ
15
15
 
16
16
 
17
17
  class << self
18
+ # ZMTP connection class used for IPC-accepted/dialed peers.
19
+ #
20
+ # @return [Class]
21
+ #
22
+ def connection_class
23
+ Protocol::ZMTP::Connection
24
+ end
25
+
26
+
18
27
  # Creates a bound IPC listener.
19
28
  #
20
29
  # @param endpoint [String] e.g. "ipc:///tmp/my.sock" or "ipc://@abstract"
@@ -13,6 +13,15 @@ module OMQ
13
13
 
14
14
 
15
15
  class << self
16
+ # ZMTP connection class used for TCP-accepted/dialed peers.
17
+ #
18
+ # @return [Class]
19
+ #
20
+ def connection_class
21
+ Protocol::ZMTP::Connection
22
+ end
23
+
24
+
16
25
  # Creates a bound TCP listener.
17
26
  #
18
27
  # @param endpoint [String] e.g. "tcp://127.0.0.1:5555" or "tcp://*:0"
data/lib/omq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OMQ
4
- VERSION = "0.26.2"
4
+ VERSION = "0.27.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.2
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger