1

有 WAMP - Web 应用程序消息传递协议(https_github.com/tavendo/WAMP/blob/master/spec/basic.md

对于后端,我使用https_github.com/voryx/Thruway

对于前面http_autobahn.ws/js/

操作系统 - 没有由 vagrant 设置的 GUI 的 Ubuntu 12

有 - PHP 5.5.9-1 和它的作曲家。

我正在尝试使用订阅和取消订阅的标准功能尝试执行取消订阅时出现“取消订阅错误”

我的订阅看起来像:

this.subscribe = function(r,clientId){
        if (!chat.searchSub("loc.wampchat.room.message." + self.room_id)) {
            chat.transport.session.subscribe('loc.wampchat.room.message.' + self.room_id, function (args, kwargs, details) {
                self.addMessage(kwargs.message, kwargs.author_id, kwargs.create_time);
            }).done(function(subscription){
                self.subscriber['loc.wampchat.room.message.' + self.room_id] = subscription;
            });
        }
        if (!chat.searchSub("loc.wampchat.join.room." + self.room_id)) {
            chat.transport.session.subscribe('loc.wampchat.join.room.' + self.room_id, function (args, kwargs, details) {
                self.addUser(chat.connections[kwargs.user_id].user);
                if(kwargs.user_id == clientId){
                    r.add(clientId);
                }
            }).done(function(subscription){
                self.subscriber['loc.wampchat.join.room.' + self.room_id] = subscription;	            
            });                
        }
        if (!chat.searchSub("loc.wampchat.leave.room." + self.room_id)) {
            chat.transport.session.subscribe('loc.wampchat.leave.room.' + self.room_id, function (args, kwargs, details) {
                self.deleteUser(kwargs.user_id);
            }).done(function(subscription){
                self.subscriber['loc.wampchat.leave.room.' + self.room_id] = subscription;
            });
        }
    };

最后一个主题(“loc.wampchat.room.message.”+ self.room_id)看起来像“loc.wampchat.room.message.1125”

它的奇怪错误,因为它只出现在主题 loc.wampchat.room.message.... 和所有其他主题(几乎相同)都很好!

退订看起来像:

for(var key in self.subscriber){
        chat.transport.session.unsubscribe(self.subscriber[key]);
    }

chat.transport.session - it's a simple global object where WAMP session is stored   

这里有什么控制台(在浏览器中,Chrome 最新版本)向我显示:

1. WebSocket transport receive
    [8,34,6196960130236416,{},"wamp.error.no_such_subscription"]



 2. (autobahn.js:791) failing transport due to protocol violation:
    UNSUBSCRIBE-ERROR received for non-pending request ID
    6196960130236416



 3. (autobahn.js:4480) Uncaught InvalidAccessError: Failed to execute
    'close' on 'WebSocket': The code must be either 1000, or between
    3000 and 4999. 1002 is neither.     
        (autobahn.js:3010) transport.close      
        (autobahn.js:3129) self._protocol_violation  
        (autobahn.js:3648) self._process_UNSUBSCRIBE_ERROR  
        (autobahn.js:4451) self._socket.onmessage   websocket.onmessage

主要的误解是,当出现此错误时,服务器根本没有反应 - 只需继续工作!我在服务器日志中看不到任何问题。

所以主要问题是:这个错误有多严重?我可以忘记它并继续我的工作还是我必须以某种方式修复它?

4

0 回答 0