와 메시징 공개/등록 세 가지 요소가 포함 된 다중 대량 회신. 메시지의 첫 번째 요소는 메시지의 종류 (예 : SUBSCRIBE 또는 UNSUBSCRIBE)입니다. 메시지의 두 번째 요소는 가입 또는 가입 취소 대상인 채널의 이름입니다. 당신이 채널에 가입에서 대량 응답의 한 부분으로 구독하는 채널의 수를 볼 수있는 멋진나는이 문서를 통해 보았다 레디 스 루비
> SUBSCRIBE first second
*3 #three elements in this message: “subscribe”, “first”, and 1
$9 #number of bytes in the element
subscribe #kind of message
$5 #number of bytes in the element
first #name of channel
:1 #number of channels we are subscribed to
: 메시지의 세 번째 요소는 현재 구독하는 채널의 수입니다. 이제 루비를 사용할 때이 답장을 다시 얻으려고합니다.
require 'rubygems'
require 'redis'
require 'json'
redis = Redis.new(:timeout => 0)
redis.subscribe('chatroom') do |on|
on.message do |channel, msg, total_channels|
data = JSON.parse(msg)
puts "##{channel} - [#{data['user']}]: #{data['msg']} - channels subscribed to: #{total_channels}"
end
end
그러나 나는 그 답장을 전혀받지 못합니다. 그것이 나에게주는 것은 채널의 이름, 그 채널에 게시 된 데이터, 그리고 total_channels은 nil입니다. 세 번째 매개 변수가 되돌려 보내지 않기 때문입니다.
그렇다면이 "다중 대량 회신"은 어디에 있습니까?