{"action":"closed","issue":{"url":"https://api.github.com/repos/fisch0920/ut_pex/issues/4","labels_url":"https://api.github.com/repos/fisch0920/ut_pex/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/fisch0920/ut_pex/issues/4/comments","events_url":"https://api.github.com/repos/fisch0920/ut_pex/issues/4/events","html_url":"https://github.com/fisch0920/ut_pex/issues/4","id":93261502,"number":4,"title":"A new extension to send plain chat message to peer","user":{"login":"vairabagni","id":3302973,"avatar_url":"https://avatars.githubusercontent.com/u/3302973?v=3","gravatar_id":"","url":"https://api.github.com/users/vairabagni","html_url":"https://github.com/vairabagni","followers_url":"https://api.github.com/users/vairabagni/followers","following_url":"https://api.github.com/users/vairabagni/following{/other_user}","gists_url":"https://api.github.com/users/vairabagni/gists{/gist_id}","starred_url":"https://api.github.com/users/vairabagni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vairabagni/subscriptions","organizations_url":"https://api.github.com/users/vairabagni/orgs","repos_url":"https://api.github.com/users/vairabagni/repos","events_url":"https://api.github.com/users/vairabagni/events{/privacy}","received_events_url":"https://api.github.com/users/vairabagni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-06T11:57:24Z","updated_at":"2016-01-01T16:31:51Z","closed_at":"2016-01-01T16:31:51Z","body":"How can I use this extension or [ut_metadata](https://github.com/feross/ut_metadata) or by creating a new one to be able to send messages to other peer (chat message) ?\r\n\r\nI just started by creating a new extension which i am thinking of integrating that into webtorrent. So I modified torrent.js (inside webtorrent, ln 463) - _onWire callback - this block is same as that of ut_pex.\r\n\r\n```Javascript\r\nif (typeof ut_message === 'function') {\r\n    wire.use(ut_message())\r\n\r\n    //wire.ut_message.start() // TODO two-way communication\r\n    wire.ut_message.on('peer', function (peer) {\r\n      debug('ut_message: got peer: %s (from %s)', peer, addr)\r\n      self.addPeer(peer)\r\n    })\r\n\r\n    wire.ut_message.on('dropped', function (peer) {\r\n      // the remote peer believes a given peer has been dropped from the swarm.\r\n      // if we're not currently connected to it, then remove it from the swarm's queue.\r\n      debug('ut_message: dropped peer: %s (from %s)', peer, addr)\r\n      var peerObj = self.swarm._peers[peer]\r\n      if (!peerObj || !peerObj.conn) self.swarm.removePeer(peer)\r\n    })\r\n  }\r\n\r\n```\r\n\r\nIs it required? Or i can just use any extension (ut_metadata, ut_pex or mine - ut_message) as:\r\n\r\n```Javascript\r\ntorrent.swarm.on(\"wire\", function(wire) {\r\n\tconsole.log(\"onwire - \" + wire.peerId + \" - \" + wire.remoteAddress + ':' + wire.remotePort);\r\n\t\t\r\n\twire.on('extended', function (ext, obj) {\r\n\t\tconsole.log('extended', ext, obj.toString());\r\n\t});\r\n\twire.use(ut_message()); \r\n        //or\r\n        wire.use(ut_metadata());\r\n        //or\r\n\twire.use(ut_pex()); \r\n\t\t\r\n\twire.extended(3, 'hello'); //first param will be either 1, 2 or 3\r\n});\r\n```\r\n\r\n"}}