-
Notifications
You must be signed in to change notification settings - Fork 46
EDU-2114: Converts SSE page to MDX #2913
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
dfb305a to
02fa986
Compare
67c765c to
31ce47a
Compare
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.
Few rendering issues here but other than that it's good
| <Code> | ||
| ```javascript | ||
| var apiKey = '{{API_KEY}}'; | ||
| var url = 'https://main.realtime.ably.net/event-stream?channels=myChannel&v=1.2&key=' + apiKey; | ||
| var eventSource = new EventSource(url); | ||
|
|
||
| eventSource.onmessage = function(event) { | ||
| var message = JSON.parse(event.data); | ||
| console.log('Message: ' + message.name + " - " + message.data); | ||
| }; | ||
| ``` | ||
|
|
||
| ```python | ||
| import json | ||
| import sseclient | ||
|
|
||
| api_key='{{API_KEY}}' | ||
| url = "https://main.realtime.ably.net/sse?channels=myChannel&v=1.2&key=%s" % (api_key) | ||
|
|
||
| def with_urllib3(url): | ||
| import urllib3 | ||
| http = urllib3.PoolManager() | ||
| return http.request('GET', url, preload_content=False) | ||
|
|
||
| response = with_urllib3(url) | ||
| client = sseclient.SSEClient(response) | ||
| for event in client.events(): | ||
| message = json.loads(event.data) | ||
| print("Channel: %s - Message: %s - %s " % (message['channel'], message['name'], message['data'])) | ||
| ``` | ||
| </Code> |
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.
This is going to cause the issue in the screenshot.
we should only render the one specific to the language, no need for the language choice in the code block.
I can't recommend the example as the triple backticks, cause issues as this is markdown textbox.
But basically it should be
If
Code
backticks-language
The actual code
backticks
EndCode
EndIf
Here is an example: https://github.com/ably/docs/pull/2927/files#diff-40e8319d4cd9fc5550d96816bea937bdb9bada6c0fd46336c7bee3928d636a48R205
| ``` | ||
| </Code> | ||
|
|
||
| <Code language="bash,javascript nodejs, python"> |
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.
| </Code> | ||
|
|
||
| <Code language="bash,javascript nodejs, python"> | ||
| ```bash |
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.
shell
|
|
||
| Once a streaming response is established, every line (other than empty lines sent as keepalive packets) will be a simple JSON object of the following form: | ||
|
|
||
| <Code language="javascript, nodejs, python"> |
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.
only.
|
|
||
| ##### Code example | ||
|
|
||
| <Code language="bash, javascript, nodejs, python"> |
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.
only.
| ##### Code example | ||
|
|
||
| <Code language="bash, javascript, nodejs, python"> | ||
| ```bash |
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.
shell
| ``` | ||
| </Code> | ||
|
|
||
| <Code> |
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 know we don't recommend in this instance making changes. But I think we should here.
First we should wrap this in an If lang="nodejs" If statement.
Then we should duplicate it and replace the <If lang="nodejs" and the backticks nodejs. with javascript.

This PR:
https://ably.com/docs/api/sseto MDXEDU-2114