Skip to content

Commit 5b33d89

Browse files
Merge branch 'feature/socket-query' of github.com:yowiputra/BuddyUp into feature/socket-query
2 parents 0beb6be + d1a037b commit 5b33d89

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

client/src/MainApp/MatchmakerPage.jsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ class MatchmakerPage extends Component {
9999
currentUserName: username
100100
})
101101
}
102-
102+
103103
componentDidMount() {
104104
this.socket = io.connect('http://localhost:3001');
105-
105+
106106
var c = this;
107107
this.socket.on("connect", () => {
108108
console.log("Connected!");
@@ -144,14 +144,13 @@ class MatchmakerPage extends Component {
144144
c.setState({ showChat: true });
145145
}
146146
})
147-
.on('disconnect', function () {
148-
this.socket.emit('disconnect');
149-
})
150147
});
151148
}
152149

153150
componentWillUnmount() {
154-
this.socket.emit('disconnect');
151+
if(this.socket){
152+
this.socket.disconnect();
153+
}
155154
}
156155

157156
updateUserSeriousness(value) {

0 commit comments

Comments
 (0)