Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Connection(socket, user, orm) {
- this.socket = socket;
- this.user = user;
- this.orm = orm;
- this.socket.client.connection = this;
- // register all handlers
- this.socket.on('listFriends', this.listFriends.bind(this));
- this.socket.on('befriend', this.befriend.bind(this));
- }
- Connection.prototype.listFriends = (data) => {
- console.log(this);
- let relations = this.orm.Relation.findAll({
- where: {
- $or: [
- {Initiator: this.user},
- {Target: this.user}
- ]
- }
- });
- this.socket.emit('listFriends', { data: relations }); //TODO
- };
- Connection.prototype.befriend = (data) => {
- };
- module.exports = Connection;
Advertisement
Add Comment
Please, Sign In to add comment