publish method
Publishes objects to channel when the call ends, as a real server
does.
When the call succeeds, every subscribed connection receives them over
the socket except the one the call named, and the response carries them
under channel (D-036) when the caller may read channel (D-053): the
call named a connection of its own account subscribed to it, or — for a
signed-in caller still signed in — the server's
DwFakeServer.subscriptionRule allows it and it is not one of
DwFakeServer.failingChannels. When the call does not succeed, the
response carries nothing and every subscriber — the named connection
included — receives them over the socket.
An unresolved DwLiveChannel.ofCaller throws ArgumentError, as on a
real server: publish to DwLiveChannel.forAccount(kind, accountId).
Implementation
void publish(DwLiveChannel channel, List<DwWireObject> objects) {
if (channel.isOfCaller) {
throw ArgumentError.value(
channel,
'channel',
'A caller channel is resolved by the client for whoever watches. '
'Name the account: DwLiveChannel.forAccount('
'${channel.kind.channelName}, accountId)',
);
}
_published.add((channel, objects));
}