My Spring boot serves as a rsocket server.
spring-boot-starter-rsocket v2.5.2 and spring-boot-starter v 2.5.2

App has a controller like so-

 @MessageMapping("request.stream")
    public Flux<String> requestStream(@Payload String userInfo) throws JsonProcessingException {
        Flux<TaskBrief> publishedEvents = Flux.create(taskUpdateNoticeConsumer).publish().autoConnect();        

     // have tried Flux.create().share() as well

    //    publishedEvents= Flux.create(taskUpdateNoticeConsumer).share();
   
        return publishedEvents.map(taskEvent -> {
          ...
         

        });
   

and rocket-js ( v0.0.23) connects and subscribes to websocket like so

details about the configuration..........................................................................

export const RsocketTaskListClient = () => {

  const client = new RSocketClient({
    transport: new RSocketWebSocketClient(
      {
        url: 'ws://localhost:8097/rsocket',
        wsCreator: (url: string) => new WebSocket(url),
        debug: true,
      }
    ),
    setup: {
      dataMimeType: "text/plain",
      metadataMimeType: 'message/x.rsocket.routing.v0',
      keepAlive: 60000,
      lifetime: 180000,
    }
  });
  const showUpdates = useCallback((msg) => {
    // Update the list
   
  }, []);
  

  useEffect(() => {        
    async function initRsocketConnection() {
      await client.connect().subscribe({        
       
        onComplete: socket => {
          socket.requestStream({
            data: "jsclient",
            metadata: String.fromCharCode("request.stream".length) + "request.stream"
          })
            .subscribe({
              onNext: (data: Payload<unknown, unknown>) => {
                ........
              },
              onError: ........,
              onSubscribe: sub => {
                sub.request(2147483647);
              }
            });
        }
      });
    }

    console.log(" calling initRsocketConnection function");
    initRsocketConnection();
    return () => {
      console.debug('will disconnect from rsocket');
      client.close();
    }
  }, [showUpdates])

  return (
    <div>rsocket web client component</div>
  )

}
  
Problem   

Js client connects and receives messages from spring controller.  But when i refresh the browser then  connection is established but it stops receiving messages.  On the server side, i see that FluxSink.next method is getting called.   
Please advice how to fix this issue.
0

There are 0 answers