Back to Browse

How to call a pub-sub / event driven API using React, JavaScript and WebSockets

2.7K views
Jan 23, 2022
17:29

This video is a quick tutorial to help you understand the basic mechanics of how pub-sub and event-driven APIs work and how you can call an asynchronous API from a browser using JavaScript, STOMP, and WebSockets. We're going to build a simple React application using JavaScript. It will call a 'Stock Ticker' API, running live over at https://transport-bus.io. The API is simple; it listens for publish events (pub) and then returns results to a client via a subscribed channel (sub). Read the article: https://quobix.com/articles/react-pubsub-websockets/ Check out the code for this project: https://github.com/daveshanley/asyncapi-tutorials/tree/main/stock-ticker AsyncAPI Contract: https://studio.asyncapi.com/?load=https://raw.githubusercontent.com/vmware/transport-go/main/plank/specs/asyncapi/plank-sample-services-asyncapi.yaml You can try out this demo for real over at: https://transport-bus.io/ts/examples/stock-ticker Your feedback and questions are most welcome.

Download

0 formats

No download links available.

How to call a pub-sub / event driven API using React, JavaScript and WebSockets | NatokHD