spring_boot_starter_websocket 0.2.0
spring_boot_starter_websocket: ^0.2.0 copied to clipboard
Declarative WebSocket clients for spring_boot_dart: an interface with @WebSocketClient, @OnMessage and @SendMessage becomes a bean; JSON via ObjectMapper, reconnection.
0.2.0 #
- the auto-configured
webSocketTransportbacks off for aWebSocketTransportregistered by an@ImportedBeanRegistrar/ImportBeanDefinitionRegistrarof the application; its condition is decided when the auto-configuration is read, like Boot'sOnBeanCondition reconnect.delay=0waits nothing (±jitter) on every attempt; from attempt 1074 the wait was NaN, which threw and stopped reconnecting.- After giving up on a server that accepts and closes at once, the retry count starts over for the next listener (it got a single attempt).
- No reconnect is made once every listener cancelled (a scheduled attempt still connected); the next listener starts afresh.
reconnect.*is checked like Spring 7'sRetryPolicy.Builder(WebSocketReconnectPolicy.validate):delayandjitternot negative,multiplierat least 1,max-delaypositive,max-retriesnot negative; anything else fails the start naming the property, with the duration written like1mor500ms. Adelayabovemax-delayis accepted, as in Spring (the waits are thenmax-delay).- The retry count is reset only once a connection proves stable (a message, or open for
reconnect.max-delay): a server that accepts and closes at once no longer keepsreconnect.max-retriesfrom stopping. - A send (or
connect()) without a connection waits for the next attempt only and fails with it (it waited forever while listeners kept reconnecting withoutmax-retries). WebSocketClientFactory.destroy()returns a future that completes once the open connections are closed (awaited bycloseAsync()).- A client's
default-request-headersreplacedefault's of the same name in any case (both were sent). reconnect.enabledtakes true / false in any case (and on / off, yes / no, 1 / 0); anything else fails the start (nopewas on).- Breaking:
WebSocketClientConfig.defaultRequestHeadersis aMap<String, List<String>>bound through the Binder:X: a,band YAML lists (X[0]) give several header values.
0.1.7 #
spring.websocket.client.config.*keys with relaxed names:connectTimeout,reconnect.maxRetries,defaultRequestHeaders.X-Shop, environment variables- Breaking: the reconnect properties are named like Spring 7's
RetryPolicy, underreconnect.*:reconnect→reconnect.enabled,reconnect-delay→reconnect.delay,max-reconnect-delay→reconnect.max-delay,max-attempts→reconnect.max-retries(retries after the first attempt:max-attempts=Nismax-retries=N-1); newreconnect.multiplier(default 2) andreconnect.jitter(default none), computed like Spring'sExponentialBackOff. - Breaking:
WebSocketClientConfig.reconnectis aWebSocketReconnectPolicy(enabled,delay,multiplier,maxDelay,jitter,maxRetries,delayFor(retry));reconnectDelay,maxReconnectDelayandmaxAttemptsare gone. - Breaking: the reconnecting
WebSocketSessionis nowWebSocketConnectionManager(Spring's name;isOpen→isConnected,send→sendMessage),WebSocketInvocationHandler.session→connectionManager;WebSocketSessionis nowspring_web_dart's open connection (formerlyWebSocketConnection).
0.1.6 #
- update road map
- ci: release with a button on main, skip new packages when publishing; shorter pubspec descriptions
0.1.5 #
- Initial version: @WebSocketClient interfaces with @OnMessage streams and @SendMessage methods, JSON through ObjectMapper, one shared connection per client opened on demand, reconnection with backoff, handshake interceptors, spring.websocket.client.config.* properties.