python - how to increase frame payload size in android autobahn websocket -


i using android autobahn websocket establish connection between android , python tornado socket server .

below autobahn websocket code using in android .

public void start() {

    final string wsuri = ip;      try {         mconnection.connect(wsuri, new websockethandler() {              @override             public void onopen() {                 log.d(tag, "connected " + wsuri);              }              @override             public void ontextmessage(string payload) {                 log.d(tag, "got echo: " + payload);              try{                  inputstream stream = new bytearrayinputstream(base64.decode((payload).getbytes(), base64.default));                 bitmap bitmap = bitmapfactory.decodestream(stream);                  image.setimagebitmap(bitmap);              } catch (exception e) {                 log.d("got exception:", e.tostring());              }                }              @override             public void onclose(int code, string reason) {                 log.d(tag, "connection lost.");                 toast.maketext(project12.this, "server closed", toast.length_short).show();             }         });      } catch (websocketexception e) {          log.d(tag, e.tostring());         toast.maketext(project12.this, "given ip adress not available", toast.length_short).show();         return;     } } 

all messages receiving in public void ontextmessage(object payload) method.

problem when sending images less 128 kb python socket server, able receive .but when sending images having size more 128 kb shows error mention below.

websocketexception (de.tavendo.autobahn.websocketexception: frame payload large)

so how can increase frame payload size.

you need use websocketoptions this:

  websocketoptions options = new websocketoptions();   options.setmaxmessagepayloadsize(1000000); //max size of message   options.setmaxframepayloadsize(1000000); //max size of frame   mconnection.connect(wsuri, new websockethandler() {},options); 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -