오래간만에 Meteor 문서를 보던 중 흥미로운 내용을 발견. publish쪽을 보다 보니 이런게 있더라. http://docs.meteor.com/#/full/publish_added Meteor.subscribe한 컬렉션에서 observe를 해보면 added/changed/removed 를 받을 수 있는데 사실은 이게 publish에서 "만들"수 있는 것. 최초 publish 에 들어왔을 때 this.ready()를 한번 해주고 들어올때마다 publish에서 add를 해주는 식이다. 외부 API를 쓴다거나 TCP/UDP 연결해서 얻은 결과물을 Collection 형태로 받을 때 매우 유용하다. 그래서 MQTT pub/sub 연동 예제를 구현해보았다. http://meteorpad.com/pad/uGoYkgrkWxBbkfJhh/mqttMeteor test.mosquitto.org 를 바라보고 MQTT 메시지를 수신하고 송신할 수 있다. 구현이 얼마없는 것에 비해 매우 잘 작동하지 않는가!? MongoDB가 아닌 외부의 비동기 호출을 통해 받은 결과를 넘겨주는 것으로 실제 publish쪽 구현은 아주 간단한데 Meteor.publish("chats", function() { var pub = this; // async function client.on('message', function(topic, message) { pub.added("chats", Random.id(), { message:message.toString(), createdAt: +new Date() }); }); this.ready(); }); 이게 전부다. subscribe쪽에 collection이 준비되었음을 알리기 위해 ready() ( http://docs.meteor.com/#/full/publish_read