Comments (15)
Namespace is supported.
Did you call socket.connect();
? Socket doesn't connect automatically.
from socket.io-client-java.
Yeah, here's the java code:
https://github.com/Urucas/sting/blob/master/app/src/main/java/com/urucas/sting/library/Sting.java#L76
is this the correct way to create a chatroom
socket = IO.socket("http://sting.jit.su/urucas-sting");
where chatroom is "/urucas-sting" ?
from socket.io-client-java.
You usually use room
feature for chatroom on server side.
http://socket.io/docs/rooms-and-namespaces/
I'd like to know the details of your problem.
Do you mean you can't connect to the server with namespace at all?
Please set log level of java.util.logging
to FINE
if you can, it would be helpful.
from socket.io-client-java.
yes, im using .of() for namesspaces but I dont know with it isnt connecting on android.
How do I set a room in the android code ?
from socket.io-client-java.
You can't set a room in the android code. It's the feature for server side.
Can you connect to server without namespace?
from socket.io-client-java.
Yes, without using namespace the library works great.
One question, how do I set the android app to connect to a certain room o namespace ? 'cause in js it works just using io("/chat-1"), I thouhgt in this library would the same
from socket.io-client-java.
IO.socket("http://sting.jit.su/urucas-sting");
is the correct way to connect to a namespace.
So I don't know why you can't connect.
It might be a bug.
from socket.io-client-java.
Please try to set log level ofjava.util.logging
to FINE
if you can. I'd like to see logs.
from socket.io-client-java.
My connection works, 'cause the Log dumps connected -> yes
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
@Override
public void call(Object... args) {
Log.i("connected", "yes")
}
});
But I think it is not sending the emit to the correct namespace.
I already put the java.util.logging to FINER. i'll copy some logs
from socket.io-client-java.
07-22 09:53:31.697 16775-16775/? I/IO﹕ new io instance for http://sting.jit.su:80/urucas/sting
07-22 09:53:54.347 16775-16818/com.urucas.library.sting I/args﹕ [Ljava.lang.Object;@42749b50
07-22 09:53:54.347 16775-16818/com.urucas.library.sting I/connected﹕ yes
That all I get from logcat
from socket.io-client-java.
do you know that socket.broadcast.emit("new user");
send data only to other sockets?
So if you want to listen 'new user' event and receive data, you have to connect with another client too.
from socket.io-client-java.
Umm, you can't see the logs of socket.io-client.java and engine.io-client.java? I don't know why.
from socket.io-client-java.
The idea is the android app control a slide on the web.
The android app emits socket.emit("right"), the server gets it and emit socket.broadcast.emit("right") and the slides on the web moves to the right.
Maybe i'll create a node server for each slide for now. This way I avoid using namespaces.
from socket.io-client-java.
Creating many servers is not good idea IMO.
If you want to emit to all clients of a namespace, do the following on the server side:
io.of('/urucas-sting').emit('new user');
it equivalent to:
// send to myself
socket.emit('new user');
// send to others
socket.broadcast.emit('new user');
from socket.io-client-java.
Found it, I was using .of() but I add another server router for the android client,
https://github.com/Urucas/sting/blob/master/js/app.js#L78
This was the original,
https://github.com/Urucas/sting/blob/master/js/app.js#L78
Using both it works!
Thanks for your replies.
from socket.io-client-java.
Related Issues (20)
- socket.io client sometimes sends arrays wrong HOT 5
- can i use multiple socket connection ?
- Android 13 not available HOT 1
- It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible HOT 3
- sendBuffer should be accessible
- Getting EVENT_CONNECT_ERROR from Android to Node HOT 1
- Change/update auth or query or extraheaders containing token after connection HOT 1
- Is this project Still Alive? HOT 3
- How to listen to Manager events? (Socket events are working) HOT 2
- Straightforward logging option for Android
- testDecodeError function in Helpers.java error message clean up HOT 2
- Report: ConcurrentModificationException when use AckWithTimout... HOT 2
- Connection state recovery HOT 1
- NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference HOT 1
- Unable to emit JSON object instead it is emitting Stringified Json in Client Version - 1.0.2 HOT 2
- Implement Connection State Recovery
- it throws java.lang.ClassCastException when sending nested json data. HOT 1
- in the this one the depencies are not dwonloading for me
- Android 14 not compatible with version 2.1.0
- received disconnect event. and socket closed.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socket.io-client-java.