Dear julia community. 

I can't figure out whats wrong here. I have a web socket implementation that 
works just fine without using protobuf on the julsa/websocket side (in fact, 
the html-client does send a protobuf array which just gets sent back without 
unpacking and packing on the julia web socket side, i.e. echo server.

the relevant lines in the web socket server are:

        msg = read(client) # This receives messages
        write(client,msg)   # This sends it back

I can then unpack it on the html-client side again just fine.

I have defined a protobuf type as 

type com
    id::Array{Int32,1}
    val::Array{Float32,1}
    com(; kwargs...) = (o=new(); fillunset(o); isempty(kwargs) || 
ProtoBuf._protobuild(o, kwargs); o)
end #type com
hash(v::com) = ProtoBuf.protohash(v)
isequal(v1::com, v2::com) = ProtoBuf.protoisequal(v1, v2)
==(v1::com, v2::com) = ProtoBuf.protoeq(v1, v2)

and the following works as it should:

iob = PipeBuffer();
writeproto(iob,com(id=[1],val=[0.2]))
msg = readproto(iob,com())
println(msg)

But when I change the relevant lines in the web socket code on the server side 
to:

msg = readproto(client.socket,com())
writeproto(client.socket,com(id=[1],val=[0.2]))

it does not work.

 I did figure out that client is a composite type and that client.socket is of 
type TCPSocket which I assume is the right variable to pass to the protobuf 
functions.

Can anyone spot what I am missing? 

the protofile is:

message com {
  repeated int32 id = 1;
  repeated float val =2;
}

Reply via email to