-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Add bidirectional communication to exchange texts #108
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: nidhal-labidi <[email protected]>
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 sure whether it's better to expose APIs for using bi-directional AND allowing to send just in one direction instead of only bi-directional then...
}; | ||
|
||
private configureDataChannel = () => { | ||
if (this.dataChannel == null) { |
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.
if (this.dataChannel == null) { | |
if (this.dataChannel === null) { |
|
||
private configureDataChannel = () => { | ||
if (this.dataChannel == null) { | ||
this.changeState('error', 'dataChannel is null. Unable to setup the configure it!'); |
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.changeState('error', 'dataChannel is null. Unable to setup the configure it!'); | |
this.changeState('error', 'dataChannel is null. Unable to configure it!'); |
if (this.dataChannel == null) { | ||
this.changeState( | ||
'error', | ||
'dataChannel is null. Unable to setup the listeners for the data channel' | ||
); | ||
return; | ||
} |
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.
Either === null
or something like this:
if (this.dataChannel == null) { | |
this.changeState( | |
'error', | |
'dataChannel is null. Unable to setup the listeners for the data channel' | |
); | |
return; | |
} | |
if (!this.dataChannel) { | |
this.changeState( | |
'error', | |
'dataChannel is not defined. Unable to setup the listeners for the data channel' | |
); | |
return; | |
} |
@@ -70,6 +71,11 @@ export class FlottformChannelHost extends EventEmitter<FlottformEventMap> { | |||
this.openPeerConnection = new RTCPeerConnection(this.rtcConfiguration); | |||
|
|||
this.dataChannel = this.createDataChannel(); | |||
if (this.dataChannel) { | |||
//this.dataChannel.bufferedAmountLowThreshold = this.BUFFER_THRESHOLD; |
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.
dead code
//this.dataChannel.bufferedAmountLowThreshold = this.BUFFER_THRESHOLD; |
@@ -5,7 +5,7 @@ | |||
import { sdpExchangeServerBase } from '../../../api'; | |||
|
|||
let currentState = $state< | |||
'init' | 'connected' | 'sending' | 'done' | 'error-user-denied' | 'error' | |||
'init' | 'connected' | 'text-transfered' | 'sending' | 'error-user-denied' | 'error' |
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.
typo
'init' | 'connected' | 'text-transfered' | 'sending' | 'error-user-denied' | 'error' | |
'init' | 'connected' | 'text-transferred' | 'sending' | 'error-user-denied' | 'error' |
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.
Shouldn't the host page have some change as well (looking for text-received
event?)
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 file src/routes/flottform-text-client/[endpointId]/+page.svelte
was created to test sending texts using Flottform. However, since we didn’t find a practical use case for sending texts at the time, we didn’t add a host file in the demo folder.
If you'd like, we can remove this file, as this PR contains a new messaging app in the demo that uses FlottformTextInputHost and FlottformTextInputClient. (demo/src/routes/flottform-messaging
and demo/src/routes/flottform-messaging-client/[endpointId]
)
…om of the messages Signed-off-by: nidhal-labidi <[email protected]>
Checklist
Reviewer
Changes
Check the issue #107