You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Spawn subscription loop with Threads.@Spawn instead of @async
- Add 'key' field to psubscribe struct
- Make callback functions in subscription accept 1 argument: SubscriptionMessage, instead of just SubscriptionMessage.message
- Lock pack_command to prevent race conditions writing to the same socket
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,7 +129,7 @@ Multiple channels can be subscribed together by providing a `Dict{String, Functi
129
129
130
130
```julia
131
131
x = Any[]
132
-
f(y) =push!(x, y)
132
+
f(y::SubscriptionMessage) =push!(x, y)
133
133
sub =open_subscription(conn)
134
134
d =Dict{String, Function}({"baz"=> f, "bar"=> println})
135
135
subscribe(sub, d)
@@ -140,7 +140,7 @@ publish(conn, "bar", "anything") # "anything" written to stdout
140
140
141
141
Pattern subscription works in the same way through use of the `psubscribe` function. Channels can be unsubscribed through `unsubscribe` and `punsubscribe`.
142
142
143
-
Note that the async event loop currently runs until the `SubscriptionConnection` is disconnected, regardless of how many subscriptions the client has active. Event loop error handling should be improved in an update to the API.
143
+
Note that the event loop spawned with Threads.@spawn currently runs until the `SubscriptionConnection` is disconnected, regardless of how many subscriptions the client has active. Event loop error handling should be improved in an update to the API.
0 commit comments