We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Here's how I implement it:
componentDidMount(){ document.addEventListener("keydown", this.handleKeyDown); (async () => { try { await this.wsp.open(); this.wsp.onmessage = (evt) => { let data = evt.data; let userInput = this.state.userInput; let cleanedUserInput = data.replace(userInput, ""); this.setState({ dataFromServer: cleanedUserInput }, () => { this.props.displayPrediction(cleanedUserInput) }) } }catch(e) { console.error(e); } })(); };
and:
sendDataToServer = () => { if(this.state.userInputLength < 7){ return this.handleErrorMessage(); } let dataToSend = this.state.userInput; (async () => { try { await this.wsp.open(); this.wsp.send(dataToSend); } catch(e) { console.error(e); } })(); this.props.togglingLoadingSection(this.state.userInput); return this.resetPrediction(); };
When the socket operates, I get the following:
index.js:1 Error: WebSocket closed with reason: (1006). at WebSocketAsPromised._handleClose (index.js:353) at WebSocket.listener (index.js:311)
The text was updated successfully, but these errors were encountered:
Hi! you should use
wsp.onMessage.addListener(evt => ...)
See: https://github.com/vitalets/websocket-as-promised#WebSocketAsPromised+onMessage
Sorry, something went wrong.
No branches or pull requests
Here's how I implement it:
and:
When the socket operates, I get the following:
The text was updated successfully, but these errors were encountered: