Skip to content

Conversation

@nidhal-labidi
Copy link
Contributor

@nidhal-labidi nidhal-labidi commented Jan 13, 2025

Checklist

Reviewer

  • I've checked out the code and tested it myself.

Changes

Check the issue #107

Signed-off-by: nidhal-labidi <nidhal.labidi@compose.us>
@nidhal-labidi nidhal-labidi requested a review from Narigo January 13, 2025 09:48
Copy link
Member

@Narigo Narigo left a 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) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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!');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
this.changeState('error', 'dataChannel is null. Unable to setup the configure it!');
this.changeState('error', 'dataChannel is null. Unable to configure it!');

Comment on lines 121 to 127
if (this.dataChannel == null) {
this.changeState(
'error',
'dataChannel is null. Unable to setup the listeners for the data channel'
);
return;
}
Copy link
Member

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:

Suggested change
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;
}


this.dataChannel = this.createDataChannel();
if (this.dataChannel) {
//this.dataChannel.bufferedAmountLowThreshold = this.BUFFER_THRESHOLD;
Copy link
Member

Choose a reason for hiding this comment

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

dead code

Suggested change
//this.dataChannel.bufferedAmountLowThreshold = this.BUFFER_THRESHOLD;

let currentState = $state<
'init' | 'connected' | 'sending' | 'done' | 'error-user-denied' | 'error'
'init' | 'connected' | 'text-transfered' | 'sending' | 'error-user-denied' | 'error'
Copy link
Member

Choose a reason for hiding this comment

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

typo

Suggested change
'init' | 'connected' | 'text-transfered' | 'sending' | 'error-user-denied' | 'error'
'init' | 'connected' | 'text-transferred' | 'sending' | 'error-user-denied' | 'error'

Copy link
Member

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?)

Copy link
Contributor Author

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 <nidhal.labidi@compose.us>
@nidhal-labidi nidhal-labidi requested a review from Narigo January 20, 2025 10:49
@nidhal-labidi
Copy link
Contributor Author

Will be divided into 3 separate PRs:

  • feat/flottform-bidirectional-data-transfer --> main: Contains changes for the FlottformChannel classes only. It provides the base necessary to allow bidirectional text and file transfer in later branches.

  • feat/bidirectional-text-exchange --> feat/flottform-bidirectional-data-exchange: Contains changes for the FlottformTextInput classes only. It provides the changes necessary to send multiple texts in both directions.

  • feat/bidirectional-text-exchange-example --> feat/bidirectional-text-exchange: Contains an example of how the bidirectional text transfer can work in practice.

@nidhal-labidi
Copy link
Contributor Author

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.

Allow Bidirectional Text Transfer using Flottform

3 participants