code: function(action) {
        let verb = action.route.verb;
        let skipHooks = action.skipHooks;
        let isMiddleware = verb === 'use';
  
        if (isMiddleware) {
          // Handler for middleware function
          return function(socket, next) {
            let ctx = adapter.createContext(socket, {}, action, adapter.options);
            return action.invoke(ctx, function (ctx) {
              if (ctx.error) return next(ctx.error);
              // Allow socketio middleware go next by checking verb and skipHooks both meeting condition
              if (skipHooks && typeof next === 'function') next();
            });
          };
        } else {
          // handler for normal function
          return function(socket, actionName, args) {
            let ctx = adapter.createContext(socket, args, action, adapter.options);
            ctx.clientActionName = actionName;
            return action.invoke(ctx);
          };
        }
      }
docs: Action wrapper