How to get store instance in a custom method of a rest adapter


#1

I have the following code:

var ApplicationAdapter = DS.RESTAdapter.extend({
    host: window.AppkitENV.hostname,
    namespace: window.AppkitENV.namespace,

    initializeSignalREvents: function(){
	    var hub = $.connection ? $.connection.instantNotificationsHub : null,
	        store = DS.get('defaultStore');
	    if (hub){
		    hub.client.add = function(message){
			    console.log('add', message);
			    store.createRecord('instant-notification', message);
		    };
		    hub.client.update = function(message){
			    console.log('update', message);
		    };
		    hub.client.remove = function(message){
			    console.log('remove', message);
		    };
	    }
    }.on('init'),
 ....

At runtime it seems that the store object is undefined. Is there another way to retrieve the store or should I change the event (on init) on that is called the method ?