-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
docs: tutorial for WebSockets with AsyncAPI #2245
Conversation
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
And that brings us to what the `payload` attribute does. It specifies the name, format, and description of all expected properties, and can even set constant values that must be followed during schema validation. | ||
For example, in `reactionPayload` schema definition, any API message received from this channel must follow the constant value for the "reaction" property which is clearly defined as “heart”. | ||
|
||
The const value feature ensures that the data exchanged through your API complies with your specified constants, helping to maintain data integrity and accuracy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The const value feature ensures that the data exchanged through your API complies with your specified constants, helping to maintain data integrity and accuracy. | |
The `const` value feature ensures that the data exchanged through your API complies with your specified constants, helping to maintain data integrity and accuracy. |
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
## Define Operations and Channels | ||
The `operation` property, is all about defining specific tasks your application can perform. Essentially, it's how my-slack-bot interacts with Slack. | ||
|
||
In this example, the `helloListenerOperation` keeps an eye out for the message sent by the Slack server when a WebSocket connection is successfully established. On the other hand, the `reactionListener` is focused on the reaction_added event type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, the `helloListenerOperation` keeps an eye out for the message sent by the Slack server when a WebSocket connection is successfully established. On the other hand, the `reactionListener` is focused on the reaction_added event type. | |
In this example, the `helloListenerOperation` keeps an eye out for the message sent by the Slack server when a WebSocket connection is successfully established. On the other hand, the `reactionListenerOperation ` is focused on the `reaction_added` event type. |
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
|
||
Your Slack application is designed to be notified of events within your workspace. It does this by subscribing to a specific event type making use of Slack's Event API. So in this case the `action` property in both the operations is set to receive events. | ||
|
||
Now, moving on to the `channels` section. The `address` specifies where the channel is tuned in to receive messages while the `messages` property defines the structure of the event it's set up to handle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be first in this section, channels are first, operations later. This way first you can just change only channels in the yaml example, and later when you talk about operations, you show both, to make references visible
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it should be Slackbot
and not SlackBot
in the title.
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
In Slack, WebSocket is employed as part of its [Socket Mode](https://api.slack.com/apis/connections/socket) feature to facilitate real-time notifications between Slack's servers and third-party applications or bots. The [Slack Event API](https://api.slack.com/apis/connections/events-api) is a tool that lets you receive real-time notifications of specific events in a Slack workspace such as messages, reactions, and user presence changes. | ||
|
||
|
||
## Define AsyncAPI Version, API Information, and Server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Define AsyncAPI Version, API Information, and Server | |
## Define AsyncAPI version, API information, and server |
We observe sentence capitalization for headers, let's make sure to fix them all :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comment.
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
sequenceDiagram | ||
Client -->> Server: Initiate WebSocket Connection | ||
Server -->> Client: WebSocket Response | ||
Server -->> Client: WebSocket Response | ||
Server -->> Client: WebSocket Response | ||
Server -->> Client: WebSocket Response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not only the server but client can sends a message in any instance of time. I would remove Response
keyword since there is no Request
or Response
in websocket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, there is a response, but not always, so yeah, can be must a message
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
pages/docs/tutorials/getting-started/slackbot-websocket-tutorial.md
Outdated
Show resolved
Hide resolved
servers: | ||
production: | ||
host: wss://wss-primary.slack.com | ||
pathname: /link/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pathname: /link/ | |
pathname: /link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VaishnaviNandakumar great work 👏🏼 I made one suggestion - you do what you think is the best
@alequetzalli on to you, no need for me to have another look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/rtm |
Description
Initial draft for a WebSocket tutorial with AsyncAPI.
Related issue(s)