Skip to main content

magic_socket 1.0.1 copy "magic_socket: ^1.0.1" to clipboard
magic_socket: ^1.0.1 copied to clipboard

Real-time broadcasting for Magic apps: the Echo facade, Reverb and null drivers, private and presence channels.

Changelog #

All notable changes to this project will be documented in this file.

1.0.1 - 2026-11-15 #

Changed #

  • The package page is https://anilcancakir.com/magic/socket and the documentation links sit under https://anilcancakir.com/magic/docs/socket.
  • An AuthChannelSubscription compares the channel it holds with the one private(name) returns by identity, so a custom BroadcastDriver must return the instance it already holds for a registered name; a driver that mints a new channel on every call makes each sync register the channel again and fire onReconnect once the new channel is confirmed. The custom driver guide lists this obligation.

Fixed #

  • Echo.leave('chat.1') now leaves the channel Echo.private('chat.1') or Echo.join('chat.1') opened, as Laravel Echo does; it used to keep the server subscription and its listeners alive. It drops all three forms of the name, so it also leaves a public chat.1. The prefixed name still works, and Echo.fake behaves the same.
  • An AuthChannelSubscription (and so ListensToBroadcasts and BroadcastListeners) receives events again after an Echo.disconnect() made elsewhere: its next sync registers the channel again and fires onReconnect once it is confirmed, or at once when another consumer already had it confirmed again.
  • Echo.fake's disconnect, leave and reset now forget the handlers and recorded subscriptions of the channels they drop and end those channels' onSubscriptionChanged streams, as the real driver does. A test that calls assertSubscribed, assertListening or dispatch after Echo.disconnect() or Echo.leave(x) now fails, and a subscription registers its channel again after a disconnect, so it appears in subscribedChannels again. A repeated channel, private or join for a name the fake still holds now returns the same handle and records no second entry in subscribedChannels, as the real driver does.
  • A websocket error on the Reverb driver reaches each interceptor's onError once; it used to run twice for one error.
  • A BroadcastInterceptor whose onSend returns an empty map now suppresses the frame, and a BroadcastEvent returned from onError now reaches the listeners of its channel, as the contract promised.
  • A websocket frame that is not JSON, or a handshake with a missing or non-string field, no longer escapes as an uncaught error: it is logged as a warning, passed to the interceptors' onError, and the connection keeps delivering events. An error thrown by an interceptor's onReceive, onSend or onError still reaches the app's zone, and onError runs once per error.
  • The documentation now says that listen compares its event name with the frame's event name exactly and resolves no namespace, unlike Echo JS. A Laravel event without broadcastAs() arrives as its full class name, so the samples now assume a broadcastAs() and the README and the Channels page show it and list the difference from Laravel Echo.
  • The documentation no longer claims that Echo.fake survives Magic.flush(): the fake lives in the container and the flush drops it; only the BroadcastListeners registry, the custom drivers and a MagicPerfHooks.sink a test sets are statics to reset.
  • The custom driver guide counts three obligations of the driver contract, not two.

1.0.0 - 2026-11-14 #

Added #

  • First release. Real-time broadcasting for Magic apps, moved out of magic core 1.0.0.
  • Echo facade: public, private and presence channels over a Laravel Reverb (Pusher protocol) websocket, automatic reconnection, connection state and reconnect streams, and message interceptors.
  • A null driver and Echo.fake (with package:magic_socket/testing.dart) so the same code runs and tests without a server.
  • BroadcastServiceProvider, the broadcastingConfig config factory, the ListensToBroadcasts controller mixin, BroadcastListeners and AuthChannelSubscription.
  • SocketIdInterceptor, which adds X-Socket-ID to Http requests so Laravel's toOthers() skips the sending device.
  • A dowel plugin provider (MagicSocketDowelProvider) that dart run magic:dowel plugin:install magic_socket registers.
  • Built on web_socket_channel ^3.0.3 and dowel ^1.0.0. Requires Dart 3.13, Flutter 3.47 and magic ^1.0.0.
0
likes
160
points
0
downloads

Documentation

API reference

Publisher

verified publisheranilcancakir.com

Weekly Downloads

Real-time broadcasting for Magic apps: the Echo facade, Reverb and null drivers, private and presence channels.

Homepage
Repository (GitHub)
View/report issues

Topics

#websocket #realtime #broadcasting #magic

License

MIT (license)

Dependencies

dowel, flutter, magic, web_socket_channel

More

Packages that depend on magic_socket