In outbound socket mode: app = Outbound("127.0.0.1", 5000, handler) but to make it working string must be app = Outbound(handler, "127.0.0.1", 5000)