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

chore(blog): added new websocket article #3394

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added diagrams
AceTheCreator committed Nov 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit a553226480dbdf468f3e8f47a739e00812211b8f
6 changes: 5 additions & 1 deletion markdown/blog/asyncapi-and-websocket.md
Original file line number Diff line number Diff line change
@@ -19,10 +19,14 @@ Recently, while building a collaborative drawing web application with WebSocket

## What Do I Mean by Spec-First?

![API spec first diagram](/public/img/diagrams/spec-first.webp)

The spec-first API development approach involves designing the API using an API specification _before_ implementing it. This method offers significant advantages, such as reducing the time needed to build the actual API, improving communication with stakeholders, and producing higher-quality APIs overall. But let’s save the deep dive into spec-first for another time and get back on track! 😄

## So Why WebSocket and AsyncAPI Instead of OpenAPI?

![Asyncapi-OpenAPI](/public/img/diagrams/asyncapi-openapi.webp)

It's not that I dislike OpenAPI (just kidding! 😄). OpenAPI isn’t ideal for my use case because it’s specifically designed for REST APIs. WebSocket, on the other hand, differs significantly from traditional HTTP. It provides a two-way communication channel over a single Transmission Control Protocol (TCP) connection, which OpenAPI doesn’t support.

In simpler terms, unlike REST APIs, where you need to make a request to get a response (a process known as polling), WebSocket does the opposite. It keeps the connection open between server and client, allowing the server to send data to the client without waiting for a request.
@@ -49,7 +53,7 @@ AsyncAPI allows your WebSocket API to validate real-time messages against predef
If, like me, you enjoy designing your API before implementation, using AsyncAPI with your WebSocket API supports an API-first approach. It enables you to thoughtfully design your API and identify message patterns early on, making it easier and faster to plan for scaling.

### **Leveraging the Tooling Ecosystem**

![AsyncAPI Ecosystem](/public/img/diagrams/ecosystem.webp)
As the industry standard for defining asynchronous APIs, AsyncAPI provides a robust ecosystem of tools. This includes capabilities like generating code in multiple languages, creating deployment-ready documentation, and setting up mock servers for development with tools like Microcks.

Now that you've seen some of the powerful things this intersection creates, let's take a look at the key concepts in AsyncAPI for our WebSocket API.
Binary file added public/img/diagrams/asyncapi-openapi.webp
Binary file not shown.
Binary file added public/img/diagrams/ecosystem.webp
Binary file not shown.
Binary file added public/img/diagrams/spec-first.webp
Binary file not shown.