0

First off, i am using HTML5 Websockets connected to a Jetty Server for communication.

All clients are publishers and subscribers. A client can publish data to a Topic and sometimes only that client will receive an update, other times everyone who is subscribed will receive a notification including the publisher.

Pavlo
  • 1,157
  • 7
  • 13
  • 1
    As long as you subscribe to whatever you is published, why couldn't the same computer be both? – OneCricketeer May 13 '17 at 12:06
  • As far as i understand it. Observer has the following methods + attach(Observer observer) + detech(Observer observer) + notifyAll() My current solution is to send the observer as an argument for the publish(Observer observer) method, so that i can reply directly to that observer without notifying everyone, however i am worried that this solution breaks the purpose of the pattern. – Pavlo May 13 '17 at 12:43
  • What you're describing sounds like a [callback function](http://stackoverflow.com/questions/824234/what-is-a-callback-function). – jaco0646 May 13 '17 at 13:32
  • The Observer pattern is the same as publish and subscribe and is commonly used in multi threaded environments, not just distributed systems – OneCricketeer May 13 '17 at 21:00

0 Answers0