breautek commented on issue #500: URL: https://github.com/apache/cordova/issues/500#issuecomment-2405661989
> Any idea why this behavior in Cordova? Is it possible to get the same tokens generation effect in Cordova without using a websocket connection? To my knowledge, Cordova doesn't do anything to effect the behaviour of server side events (SSE) or web sockets and they should work out of the box providing that the client is configured with the proper CSP policy on the client, and CORS policy on the server side. Cordova is afterall, a packager. It does not implement the browser features like websockets or SSE. Cordova does allow plugins, so unless if you have a plugin installed that overrides the `EventSource` JS object, then you're using the standard browser feature as implemented in the webview. Cordova itself doesn't implement any Event emitter plugins. The browser application and the webview are two different components on the device and they could be built with different configurations, so there could be a difference of behaviour, but as long as the server is following the protocol I wouldn't expect any significant difference. I'm not familiar with the Java library that you're using so I'll speak for a more general sense. For SSE, the server should be: 1. Responding with `Content-Type: text/event-stream` header 2. Use double newline character (`\n`) to indicate the end of an event package. If you're dealing with small data chunks, the server might have to explicitly flush the socket to forcefully send data through. If the server is sending data without events, then the client should be listening for messages on the `.onmessage` handler/event. Otherwise the client should use `.addEventListener("eventName")`. For example if the server sends `ping:\n\n` it will send a `ping` event, which the client can listen for `.addEventListener("ping", ...)`. I'd assume that your `SseEmitter` class would be handling these details, but if you want to rule it out potential issues with the `SseEmitter` implementation, it's fairly straight forward implementing your own SSE emitter using a raw http server. If it works consistently on both the webviews and browsers with your own emitter server, then it would indicate a problem inside the `SseEmitter` implementation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org