Skip to content

examples: add a WebSocket example #218

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

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

lance
Copy link
Member

@lance lance commented Jun 10, 2020

There is nothing really to do in order to support events over websockets.
Since a CloudEvent can easily be represented in full with JSON, it can
be sent over a websocket as event.toString().

Fixes: #156

@lance lance added the module/docs Module documentation changes label Jun 10, 2020
@lance lance requested a review from a team June 10, 2020 19:28
@lance lance self-assigned this Jun 10, 2020
@lance lance requested review from danbev, grant and helio-frota and removed request for a team June 10, 2020 19:28
@lance lance force-pushed the 156-websocket-example branch from 4d52c24 to 87b38f5 Compare June 10, 2020 19:29
@n3wscott
Copy link
Member

THIS IS AWESOME

@lholmquist
Copy link
Contributor

LGTM

@@ -0,0 +1,14 @@
<!DOCTYPE html>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know there is an issue related to this sdk being available in the browser, but maybe that can be another commit since it doesn't have to do with the websocket example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lholmquist I'm actually thinking of modifying this example so that the client just sends a zip code to the server, which responds with a weather event. And I'll add an index.html to this example and have it also connect to the web socket. :)

There is nothing really to do in order to support events over websockets.
Since a `CloudEvent` can easily be represented in full with JSON, it can
be sent over a websocket as `event.toString()`.

Fixes: cloudevents#156
Signed-off-by: Lance Ball <lball@redhat.com>
@lance lance force-pushed the 156-websocket-example branch from 5bdc1af to 843a564 Compare June 10, 2020 21:32
@lance
Copy link
Member Author

lance commented Jun 10, 2020

Depends on #201

/cc @n3wscott browser support added to this example

@lance lance merged commit 99bb88b into cloudevents:master Jun 10, 2020
@lance lance deleted the 156-websocket-example branch June 10, 2020 21:50
@lance lance mentioned this pull request Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/docs Module documentation changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to send/receive events via the websocket protocol
5 participants