rn-eventsource icon indicating copy to clipboard operation
rn-eventsource copied to clipboard

Not working in RN 0.62

Open zabka229 opened this issue 4 years ago • 1 comments

Hello, With React Native 0.61 I was using this pollyfill: https://github.com/jordanbyron/react-native-event-source

Everything worked perfectly, but then React native released new version - 0.62. I created new project for testing purposes and suddenly it stopped working.

So I installed this library and it does not work either. Request with authorization token succeeds so I have no idea why no message is coming. I am testing on physical Android device.

import EventSource from 'rn-eventsource'

class SSE {

    constructor() {
        this.eventSource = null
        this.init()
    }

    init() {
        const options = { headers: { Authorization: 'Bearer ' + data.token } }
        this.eventSource = new EventSource(env.urls.apiUrl + '/event', options)
        console.log(this.eventSource)
        this.eventSource.onmessage = (event) => {
            console.log(event);
        }
    }

    close() {
        if (this.eventSource) {
            this.eventSource.close()
            this.eventSource = null
        }
    }

}

export default new SSE()

zabka229 avatar Apr 04 '20 10:04 zabka229

Same here, tested with this http://express-eventsource.herokuapp.com/ demo;

chaosuperDK avatar Apr 28 '20 07:04 chaosuperDK