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

Websocket watcher #517

Merged
merged 30 commits into from
Dec 17, 2024
Merged

Websocket watcher #517

merged 30 commits into from
Dec 17, 2024

Conversation

capyq
Copy link
Contributor

@capyq capyq commented Jul 11, 2024

This is a web socket tools.
How to use:

  • Add Websocket component and list all ws url.
  • when you need to listen message, use the new hook useListerner(urlKey, callback)
    • urlkey => the key provide in the component Websecoket
    • callback => function to call when message arrive.

@capyq capyq force-pushed the websocket-watcher branch from 47192d8 to 1f98ddc Compare July 12, 2024 08:49
demo/src/app.jsx Outdated Show resolved Hide resolved
demo/src/app.jsx Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
type WebsocketProps = { urls: Record<string, string> };
function Websocket({ urls, children }: PropsWithChildren<WebsocketProps>) {
const urlsListenersRef = useRef(
Object.keys(urls).reduce((acc, urlKey) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not recomputed if urls change

@capyq
Copy link
Contributor Author

capyq commented Sep 13, 2024

@sBouzols rebase done.

capyq added 14 commits October 11, 2024 14:12
Signed-off-by: capyq <quentin.capy@rte-france.com>
… custom hook )

Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
…ve usage from demo

Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
Signed-off-by: capyq <quentin.capy@rte-france.com>
@capyq capyq force-pushed the websocket-watcher branch from 6ce89b5 to 6b28775 Compare October 11, 2024 13:07
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 292 files.

Valid Invalid Ignored Fixed
273 1 18 0
Click to see the invalid file list
  • src/components/websocket/index.ts

src/components/websocket/index.ts Outdated Show resolved Hide resolved
sBouzols and others added 2 commits October 11, 2024 15:09
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link

sonarcloud bot commented Oct 11, 2024

Signed-off-by: sBouzols <sylvain.bouzols@gmail.com>
Signed-off-by: sBouzols <sylvain.bouzols@gmail.com>
…components, hooks and types.

"onopen" event broadcast is renamed "onreopen" to point out that the event is not broadcast at first open as long as there is no listener registered (context uninitialized)

Signed-off-by: sBouzols <sylvain.bouzols@gmail.com>
Signed-off-by: sBouzols <sylvain.bouzols@gmail.com>
fix(NotificationsProvider): filter urls to avoid undefined urls when creating connections

Signed-off-by: sBouzols <sylvain.bouzols@gmail.com>
Signed-off-by: sBouzols <sylvain.bouzols@gmail.com>
Copy link

sonarcloud bot commented Dec 17, 2024

@sBouzols sBouzols merged commit ce8496a into main Dec 17, 2024
5 checks passed
@sBouzols sBouzols deleted the websocket-watcher branch December 17, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants