有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和它的作曲家。
我尝试使用订阅和取消订阅的标准功能 我得到了#34;取消订阅ERROR"在尝试执行取消订阅时
我订阅的内容如下:
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-latest)显示给我:
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
主要的误解是当这个错误出现时服务器根本没有反应 - 只需继续工作! 我没有在服务器日志中看到任何问题。
所以主要的问题是:这个错误有多重要?我可以忘记它并继续我的工作,或者我必须以某种方式解决它?