RSocket error 0x201 (APPLICATION_ERROR): empty String

266 Views Asked by At

I have an Roscket connection from the browser(in an create-react-app ecosystem) to a spring netty server, connection is working but after some time I am getting the following error on the client side(rsocket js 0.0.27)

RSocket error 0x201 (APPLICATION_ERROR): empty String. See error `source` property for details.
    at createErrorFromFrame (RSocketFrame.js:271:1)
    at RSocketMachineImpl._handleStreamFrame (RSocketMachine.js:691:1)
    at Object.onNext (RSocketMachine.js:254:1)
    at FlowableSubscriber.onNext (Flowable.js:249:1)
    at ReassemblySubscriber.onNext (ReassemblyDuplexConnection.js:132:1)
    at RSocketWebSocketClient.js:80:1
    at Set.forEach (<anonymous>)
    at WebSocket.<anonymous> (RSocketWebSocketClient.js:80:1)

the server shows no error from it's side and after resetting the client continues, can someone help me with this issue? and if not maybe provide a recovery workaround to re-init the socket?

the client code:


export async function createRsocketClient() {
    const setup = {
        keepAlive: 100000000,
        lifetime: 10000000,
        dataMimeType: 'application/json',
        metadataMimeType: 'message/x.rsocket.routing.v0',
    };
    console.log("connecting with RSocket...");
    const transport = new RSocketWebsocketClient({url: 'ws://localhost:8081/rsocket'});
    const client = new RSocketClient({ setup, transport, serializers: {data: JsonSerializer, metadata: IdentitySerializer}});
    return client.connect();
}

async function getLiveSubscriptionFromServer() {
        const rsocket = await createRsocketClient();
        rsocket.requestStream({metadata: String.fromCharCode('live'.length) + 'live'}).subscribe({
            onNext: (msg) => {console.log(`msg`);},
            onComplete: () => {
                console.log(`requestStream completed`);
            },
            onError: (error) => {
                console.error(error);
            },
            onSubscribe: subscription => {
                subscription.request(100000000); // set it to some max value this is the subscription timeout
            }
        })
        return rsocket;
    }

package json RSocket dependencies(webpack dep is for buffer issue) :

    "rsocket-core": "0.0.27",
    "rsocket-websocket-client": "0.0.27",
    "node-polyfill-webpack-plugin": "^2.0.1",
1

There are 1 best solutions below

0
On BEST ANSWER

Issue was resolved when upgrading to version: 1.0.0-alpha.3 as 0.0.27 is not maintained I think there will not be a solution for that version