Skip to content

Jake#3

Open
Loaye wants to merge 9 commits intocodefellows-javascript-401d17:masterfrom
Loaye:jake
Open

Jake#3
Loaye wants to merge 9 commits intocodefellows-javascript-401d17:masterfrom
Loaye:jake

Conversation

@Loaye
Copy link
Copy Markdown

@Loaye Loaye commented Jul 25, 2017

No description provided.

server.js Outdated
var client = new Client(socket);
pool.push(Client);

socket.on('data', (socket) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you are passing in socket here to this function. This is actually the data part so the better word to use would be data. It is also erring out on the next line when you try to access data.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed socket to data

server.js Outdated

ee.on('@all', (client, string) => {
pool.forEach((c) => {
c.socket.write(`${client.nickname}: ${message}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what is message here? do you mean string?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

message is changed from message to string. I did this because we didnt set the string to a var like message like we did the block up.

model/client.js Outdated
'use strict';

const uuidv4 = require('uuid-v4');
const Client = module.exports = (socket) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is throwing an error that Client is not a constructor. I was able to fix it by changing it back to the pattern used in class by Brian. Switch it back to the word function to get this to work.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed from fat arrow to normal function declaration because when using 'this.' with fat arrow it is just taking everything from the scope. So we do a normal function declaration because it will pass whatever is filled into the arguments.

server.js Outdated
});

server.on('connection', (socket) => {
var client = new Client(data);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The sockets that I meant needed to be changed here is the one in the socket .on('data', (socket) => { below. Sorry if I messed up this comment. The cient(socket) to the client I believe is fine but when you call data.toString() on 41 it broke.

server.js Outdated
pool.forEach((c) => {
if(client.nickname === client.nickname){
pool.splice(i);
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You are missing a closing }) here. It looks correct right now because the indentation on the if block is shifted one over but it breaks your server file.

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.

2 participants