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

joinRealtimeChannel method with webxdc realtime API #78

Merged
merged 23 commits into from
May 31, 2024
Merged

Conversation

hpk42
Copy link
Contributor

@hpk42 hpk42 commented Apr 22, 2024

alternative to #77 implementing all realtime functiuonality through a single joinRealtimeChannel object.

@hpk42 hpk42 changed the title Alterantive joinRealtimeSession method for managing realtime sessions Alternative joinRealtimeSession method for managing realtime sessions Apr 22, 2024
src-docs/spec/joinRealtimeSession.md Outdated Show resolved Hide resolved
src-docs/spec/joinRealtimeSession.md Outdated Show resolved Hide resolved
src-docs/spec/joinRealtimeSession.md Outdated Show resolved Hide resolved
@hpk42 hpk42 changed the title Alternative joinRealtimeSession method for managing realtime sessions Alternative joinRealtimeChannel method for managing realtime sessions Apr 24, 2024
@hpk42 hpk42 changed the title Alternative joinRealtimeChannel method for managing realtime sessions joinRealtimeChannel method with webxdc realtime API Apr 24, 2024

Start listening on the realtime channel using the specified callback.
The callback receives `Uint8Array` data items that were sent from connected peers.
Calling `setListener` a second time will replace the previous listener.
Copy link
Contributor

Choose a reason for hiding this comment

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

what happens if the passed value is something other than a function? for instance:

realtimeChannel.setListener()

Will that throw an error, or cause it to stop listening?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i guess it should throw an error -- Also "send()" should throw an error if not argument is provided. FWIW in Python the interpreter would do it itself and there is no need to specify that extra. Maybe we can get to make it a general practise in webxdc APIs to throw errors when the minimally specified arguments are not passed in, also for setUpdateListener etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will do so

src-docs/SUMMARY.md Outdated Show resolved Hide resolved
src-docs/spec/joinRealtimeSession.md Outdated Show resolved Hide resolved
connected peers but not by peers connecting later.

Calling `joinRealtimeChannel` a second time without leaving the prior one
will not cause any action and returns a `null` value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe better not specify it? Something happens, maybe null, maybe an exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hum, I prefer APIs that have defined results so that i don't need to check for any of undefined, null or exception to notice errors.

hpk42 and others added 2 commits April 24, 2024 16:01
Co-authored-by: link2xt <link2xt@testrun.org>
@Septias
Copy link
Contributor

Septias commented May 13, 2024

Should we merge this @hpk42 I think it is stable now

@hpk42 hpk42 merged commit 125a6ce into main May 31, 2024
@link2xt link2xt deleted the hpk/realtime2 branch June 1, 2024 01:37
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.

None yet

4 participants