public void open(WaveId id, IdFilter filter, WaveWebSocketCallback stream) {
// Prepare to receive updates for the new stream.
streams.put(id, stream);
// Request those updates.
ProtocolOpenRequestJsoImpl request = ProtocolOpenRequestJsoImpl.create();
request.setWaveId(ModernIdSerialiser.INSTANCE.serialiseWaveId(id));
request.setParticipantId(userId);
for (String prefix : filter.getPrefixes()) {
request.addWaveletIdPrefix(prefix);
}
// Issue 161: http://code.google.com/p/wave-protocol/issues/detail?id=161
// The box protocol does not support explicit wavelet ids in the filter.
// As a workaround, include them in the prefix list.
for (WaveletId wid : filter.getIds()) {
request.addWaveletIdPrefix(wid.getId());
}
socket.open(request);
}