r3labs / sse

Server Sent Events server and client for Golang
Mozilla Public License 2.0
864 stars 180 forks source link

Multiple rows of data produce the wrong data format when processing event #90

Closed jalen-qian closed 3 years ago

jalen-qian commented 3 years ago

Hi, when I listen to the Subscribtions event,I received the wrong data . It should be JSON format. Is there something wrong in the func processEvent ? ( ps : client.go:287) The origin data is as follow:

:
id: urn:uuid:04d6eadc-c270-406c-99c9-f6ce93499db6
data: {
data:   "@context": "https://mercure.rocks/",
data:   "id": "/.well-known/mercure/subscriptions/%2Fstarship%2Faa%2F%7Bevent%7D/urn%3Auuid%3A9605f26e-b6e7-4a36-a0cf-4126ef44647b",
data:   "type": "Subscription",
data:   "subscriber": "urn:uuid:9605f26e-b6e7-4a36-a0cf-4126ef44647b",
data:   "topic": "/starship/aa/{event}",
data:   "active": false,
data:   "payload": {
data:     "cluster_code": "aa"
data:   }
data: }

And the data I got is:

}  }    "cluster_code": "aa"  "payload": {  "active": false,  "topic": "/starship/aa/{event}",  "subscriber": "urn:uuid:9605f26e-b6e7-4a36-a0cf-4126ef44647b",  "type": "Subscription",  "id": "/.well-known/mercure/subscriptions/%2Fstarship%2Faa%2F%7Bevent%7D/urn%3Auuid%3A9605f26e-b6e7-4a36-a0cf-4126ef44647b",  "@context": "https://mercure.rocks/",{
purehyperbole commented 3 years ago

Hey @jalen-qian

Sorry for the delay in getting back to you!

Not sure if this is still useful for you, but this should now be resolved in v2.3.3.

jalen-qian commented 3 years ago

Hey @purehyperbole That's great! You solved my problem. Thank you!