Skip to content

Instantly share code, notes, and snippets.

@lholmquist
Created June 19, 2013 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lholmquist/5814405 to your computer and use it in GitHub Desktop.
Save lholmquist/5814405 to your computer and use it in GitHub Desktop.
//Create a notifier with the vertx apadter
notifierVertx2 = AeroGear.Notifier({
name: "client2",
settings: {
autoConnect: true,
connectURL: window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + "/eventbus",
onConnect: function() {
console.log( "connected" );
},
onConnectError: function() {
console.log( "connection error" );
},
onDisconnect: function() {
console.log( "Disconnected" );
},
channels: [ channelObject ]
}
});
// Create a notifier with stompws adapter
notifierStomp = AeroGear.Notifier({
name: "stompClient",
type: "stompws",
settings: {
onConnect: function() {
console.log( "connected" );
},
onConnectError: function( event ) {
console.log( "connection error", event );
},
onDisconnect: function() {
console.log( "Disconnected" );
},
connectURL: "ws://localhost:61614/stomp",
channels: [ stompChannel ]
}
});
// When the stompws notifier is created this way, the onXXX methods are actually ignored and there is no autoConnect
// you would need to pass these onXXX methods when calling connect
// These should be easy fixes to get these 2 adapters in line
// Just wanted to see what others though
@matzew
Copy link

matzew commented Jun 19, 2013

So, with an autoConnect these onXXX functions would not be ignored, in the way they are alined above ?

@lholmquist
Copy link
Author

the sentence i wrote is a little confusing.

the onXXX methods are ignored on the stompws adapter and need to be specified when calling connect. If we add a autoConnect, then we need to make sure they are not ignored

The vertx adapter will not ignore those methods, even if calling autoConnect === true, they can also be overridden in the connect methods is you feel like it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment