2017-06-08 16:03:54 +00:00
|
|
|
'use strict';
|
2017-02-18 07:51:11 +00:00
|
|
|
|
2017-06-08 16:03:54 +00:00
|
|
|
import Stream from './stream';
|
2017-02-18 07:51:11 +00:00
|
|
|
|
2017-06-08 16:03:54 +00:00
|
|
|
/**
|
|
|
|
* Messaging stream connection
|
|
|
|
*/
|
|
|
|
class Connection extends Stream {
|
|
|
|
constructor(me, otherparty) {
|
|
|
|
super('messaging', {
|
|
|
|
i: me.token,
|
|
|
|
otherparty
|
|
|
|
});
|
2017-02-18 07:51:11 +00:00
|
|
|
|
2017-06-08 16:03:54 +00:00
|
|
|
this.on('_connected_', () => {
|
|
|
|
this.send({
|
|
|
|
i: me.token
|
|
|
|
});
|
|
|
|
});
|
2017-02-18 07:51:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-18 11:05:11 +00:00
|
|
|
export default Connection;
|