Post by faisalbhagati have written new Version of RemoteViewServiceMultiplexer for
ConsoleClient in this i hv replaced all protocol requests to pst
generated code purely in java
like for open method.
public void open(WaveId id, IdFilter filter, WaveWSCallback stream) {
// Prepare to receive updates for the new stream.
streams.put(id, stream);
// Request those updates.
ProtocolOpenRequest.Builder request =
ProtocolOpenRequest.newBuilder();
request.setWaveId(id.serialise());
request.setParticipantId(userId);
for (String prefix : filter.getPrefixes()) {
request.addWaveletIdPrefix(prefix);
}
for (WaveletId wid : filter.getIds()) {
request.addWaveletIdPrefix(wid.getId());
}
socket.sendMessage(request.build(), null);
}
Now the next step i have is that socket which i have in
RemoteViewServiceMultiplexer is WaveWebSocketClient its methods are
again
expecting JSON objects . For example socket.sendMessage i m writing
console verision of WaveWebsocketClient
i have written send Message in it like that.
public void sendMessage(GeneratedMessage message,
SubmitResponseCallback callback) {
int seqNo = sequenceNo++;
StringBuffer buffer=new StringBuffer("{");
buffer.append("version:1");
buffer.append(",");
buffer.append("sequenceNumber:"+seqNo);
buffer.append(",");
if(message instanceof ProtocolOpenRequest)
{
buffer.append("messageType:ProtocolOpenRequest");
}else
if(message instanceof ProtocolSubmitRequest)
{
buffer.append("messageType:ProtocolSubmitRequest");
}else if(message instanceof ProtocolSubmitRequest)
{
buffer.append("messageType:ProtocolAuthenticateRequest");
}
buffer.append("'");
buffer.append("messageJson:"+message.toByteArray());
buffer.append("}");
send(buffer.toString());
}
m i right?
classes should do. You shouldn't need to do any string building.
The PST generated classes are in build/messages/...
what you're attempting and its context? Follow the instructions here:http://www.waveprotocol.org/code/submitting-code(even though you won't
necessarily submit the changes right away).
...