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

Node v10 changes and added consistency with .NET core example #4

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

dirkpennings
Copy link

@dirkpennings dirkpennings commented Dec 4, 2019

Node v10 changes. And check CHANGELOG.md for more changes

console.log(`${id} disconnected`);
});

chat.on('send', (message) => {
chat.clients.all.send('send', message);
chat.on('SendMessage', (user, message) => {
Copy link
Author

Choose a reason for hiding this comment

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


const chat = signalR.mapHub('/chat');
const chat = signalR.mapHub('/chatHub');
Copy link
Author

Choose a reason for hiding this comment

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

@dirkpennings dirkpennings changed the title Changed _methods declaration so Node v10 also works Node v10 changes, CORS additions, settings added and added consistency with .NET core example Dec 11, 2019
}
else {
this._doHandshakeResponse(
`Requested protocol '${handshakeMessage.protocol}' is not available.`
Copy link
Owner

Choose a reason for hiding this comment

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

Why this formatting change?

Copy link
Author

Choose a reason for hiding this comment

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

Ah this is caused by the .prettierrc file printWidth setting I guess (max 100 chars per line)

constructor() {
this._methods = new Map();
Copy link
Owner

Choose a reason for hiding this comment

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

Why did you make this a member?

Copy link
Author

Choose a reason for hiding this comment

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

This was the part where Node v10 failed. I figured this would be an easy solution but not sure

@@ -39,12 +39,12 @@ class HubConnection {
this._closeHandler = null;

this._handshakeTimeout = setTimeout(() => {
if (!this._handshake) {
if (!this._handshake && this.connection) {
Copy link
Author

Choose a reason for hiding this comment

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

failed sometimes when reconnecting / session ended, not sure but this fixed it.

Copy link
Owner

Choose a reason for hiding this comment

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

Hmm.

for (const group of client.groups) {
// REVIEW: Performance..
this.removeFromGroup(connection.id, group);
if (client) {
Copy link
Author

Choose a reason for hiding this comment

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

failed sometimes when reconnecting / session ended, not sure but this fixed it.

<input type="text" id="user" placeholder="user" required /><br />
<input type="text" id="message" placeholder="message" required /><br />
<button type="submit" id="send">Send</button>
</form>
Copy link
Author

Choose a reason for hiding this comment

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

updated the form so it matches the .NET example (hence the user field)

connection.on('send', message => {
var li = document.createElement('li');
li.innerText = message;
connection.on('ReceiveMessage', (user, message) => {
Copy link
Author

Choose a reason for hiding this comment

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

updated the event names so it matches the .NET example

@dirkpennings dirkpennings changed the title Node v10 changes, CORS additions, settings added and added consistency with .NET core example Node v10 changes and added consistency with .NET core example Dec 13, 2019
chat.on('send', (message) => {
chat.clients.all.send('send', message);
chat.on('sendmessage', (user, message) => {
chat.clients.all.send('receivemessage', user, message);
Copy link
Author

Choose a reason for hiding this comment

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

changed this to lowercase events for consistency with the "sendmessage" toLowerCase function in signalr.js

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.

3 participants