Add data plane commands to az webpubsub#3318
Conversation
|
webpubsub |
| event <event-name> <message> : Send event to event handler | ||
| -------------------------- | ||
| """ | ||
| print(comment) |
There was a problem hiding this comment.
I recommend to print comments to stderr
There was a problem hiding this comment.
print here is not an error
There was a problem hiding this comment.
I see, CLI usually print help message and error message in stderr stream.
There was a problem hiding this comment.
What's the recommend way to print message to stderr in CLI, print('message', file=sys.stderr)?
There was a problem hiding this comment.
stderr is used for error and diagnostic messages: https://www.cplusplus.com/reference/cstdio/stderr/
But for interactive commands like this one, using stderr and stdout makes little difference.
| payload = json.dumps({ | ||
| 'type': 'event', | ||
| 'event': event, | ||
| 'data': data |
There was a problem hiding this comment.
I'm curious about why event payload doesn't need ackId
There was a problem hiding this comment.
From current webpubsub's spec, event doesn't support ackId
| publisher.daemon = True | ||
| publisher.start() | ||
| while True: | ||
| print(await ws.recv()) |
There was a problem hiding this comment.
When a user is typing messages and ws received something, it will breaking the input line in terminal display.
There was a problem hiding this comment.
I see, but it seems not easy to make it excellence. I think it's acceptable when it's used as a debugging tool.
There was a problem hiding this comment.
I see. Maybe it's not hard. You can make a switch between typing context and display context by enter key. When user in typing context, you can hold the received data form ws. And print them after switch to display context.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally?For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update
src/index.jsonautomatically.The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify
src/index.json.