java - Phoenix channel.push not working on Android -


i trying have chat in application using phoenix channels. have web client , and android client. right working correctly on web. having issue android side.

it able receive messages pushed channel, wont send out. when try push message following exceptions thrown:

java.net.sockettimeoutexception: timeout exception

java.lang.illegalstateexception: message writer active. did call close()?

my chat channel

defmodule goodapi2.chatchannel  use phoenix.channel   intercept(["chat_send"])   def join("chat:"<> _room_code, _message, socket)      {:ok, socket}  end   def handle_in("chat_send", message, socket)      broadcast! socket, "chat_send", message      {:noreply, socket}  end   def handle_out("chat_send", payload, socket)      push socket, "new_message", payload      {:noreply, socket}  end end 

on android app creating channel

try{ socket = new socket("ws:"+apiutils.base.tostring()+"socket/websocket");         socket.connect();         channel = socket.chan("chat:"+chatname, null);          channel.join()                 .receive("ok", new imessagecallback() {                     @override                     public void onmessage(envelope envelope) {                         system.out.println("ignore");                     }                 });       }       catch (ioexception e) {         system.out.println("error connecting chat");         e.printstacktrace();      } 

on android app pushing channel

public void sendmessage(final string message){  objectnode node = new objectnode(jsonnodefactory.instance)                         .put("sender", email)                         .put("sender_name", username)                         .put("content", message);     try{         channel.push("chat_send", node);        }   catch (exception e){          log.e("message failed send",  message);         }      } 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -