Binding events in a plugin

Binding events in a plugin

I'm trying to write a jQuery Websocket wrapper. I realise there are a couple out there, but I am using this as a means to learn how to write jQuery plugins.

I have nothing websocketty written yet, I'm having a more fundamental issue.

My code, thus far, is as follows
  1. (function($){
  2.     var methods = {
  3.         init:function(options)
  4.         {
  5.             console.log("Innited ");
  6.             return this.each(function()
  7.                 {
  8.                    
                    }
  9.             );
  10.         },
  11.         poke:function()
  12.         {
  13.             console.log("poked");
  14.         }
  15.     };   
  16.     $.websocket = function(method)
  17.     {
  18.         if ( methods[method] )
  19.         {
  20.             return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
  21.         }
  22.         else if ( typeof method === 'object' || ! method )
  23.         {
  24.             var self = methods.init.apply(this, arguments);
  25.             this.bind('poke', methods.poke);
  26.             return self;
  27.         }
  28.         else
  29.         {
  30.             $.error( 'Method ' +    method + ' does not exist on jQuery.websocket' );
  31.         }       
  32.     }
  33. })(jQuery);
In the html file I have included it in, I have

  1. $(
  2.       function()
  3.       {
  4.             var test = $.websocket();
  5.             console.log("Websocket inited?");
  6.             $(test).trigger('poke');
  7.       }
  8. );
But I'm not getting the event method being invoked.
$.websocket('poke'); does exactly what I'd anticipate it would do, but I'm having difficulty figuring out how to get it to do what I want.