Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no data output from events() #18

Open
JinlongWukong opened this issue Jan 23, 2019 · 3 comments
Open

no data output from events() #18

JinlongWukong opened this issue Jan 23, 2019 · 3 comments

Comments

@JinlongWukong
Copy link

sorry to bother you,

I have a question here, if the server side send out event data stream but without (empty new line), then this sseclient will hang there, right? in this case , how to make it work?
thanks for your time

@mpetazzoni
Copy link
Owner

The empty new line is a key part of the SSE spec to separate events being sent by the server. If the server is not sending the empty new line between event then it is not compliant with the specification.

Do you have an example of the server response?

@JinlongWukong
Copy link
Author

Thanks for you promt reply.
Below is example notification output by using curl command

data:   "ietf-restconf:notification": {
data:     "eventTime": 2019-01-17T05:44:23.073+00:00,
data:     "rmno:network-service": {
data:       "operation": "undeploy",
data:       "status": "init",
data:       "vnf": [
data:         {
data:           "name": "demo_service_mme-7-demo_service_mme",
data:           "esc": {
data:           },
data:           "location": {
data:           }
data:         }
data:       ]
data:     }
data:   }
data: }
data: {
data:   "ietf-restconf:notification": {
data:     "eventTime": 2019-01-17T05:44:23.094+00:00,
data:     "rmno:network-service": {
data:       "operation": "undeploy",
data:       "status": "init",
data:       "vnf": [
data:         {
data:           "name": "demo_service_mme-7-demo_service_mme",
data:           "esc": {
data:           },
data:           "location": {
data:           }
data:         }
data:       ]
data:     }
data:   }
data: }
data: {
data:   "ietf-restconf:notification": {
data:     "eventTime": 2019-01-17T05:45:08.207+00:00,
data:     "rmno:network-service": {
data:       "operation": "undeploy",
data:       "status": "done",
data:       "vnf": [
data:         {
data:           "name": "demo_service_mme-7-demo_service_mme",
data:           "esc": {
data:           },
data:           "location": {
data:           }
data:         }
data:       ]
data:     }
data:   }
data: }

@mpetazzoni
Copy link
Owner

That is indeed not specification-compliant and would be interpreted as one single large event. Ideally you should change the server to correctly emit an empty new line between each event. Otherwise you'd have to hack something into this library to infer when it is appropriate to dispatch an event (most likely here: https://github.com/mpetazzoni/sseclient/blob/master/sseclient/__init__.py#L51).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants