Giter Site home page Giter Site logo

Handshake Data about socket.io-client-java HOT 7 CLOSED

socketio avatar socketio commented on July 17, 2024
Handshake Data

from socket.io-client-java.

Comments (7)

nkzawa avatar nkzawa commented on July 17, 2024

What do you mean?
Let me know what you need actually.

from socket.io-client-java.

aradhell avatar aradhell commented on July 17, 2024

yes you can add by query like this
socket = IO.socket("http://xxxx:3000?token="
+ user_token_ + "&user_id=" + user_id_);

from socket.io-client-java.

gulsharan-pv avatar gulsharan-pv commented on July 17, 2024

@ankushsachdeva Are you looking for this?

    socket = IO.socket("http://localhost:3000/");

    // Set-up handshake data
    socket.io().on(Manager.EVENT_TRANSPORT, new Emitter.Listener() {
        @Override
        public void call(Object... args) {
            Transport transport = (Transport)args[0];
            transport.on(Transport.EVENT_REQUEST_HEADERS, new Emitter.Listener() {
                @Override
                public void call(Object... args) {
                    Map<String, String> headers = (Map<String, String>) args[0];
                    headers.put("hello", "world");
                }
            });
        }
    });

    // Set-up socket listeners
    socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
        @Override
        public void call(Object... args) {
            System.out.print("Connected!");
        }
    });

from socket.io-client-java.

ankushsachdeva avatar ankushsachdeva commented on July 17, 2024

@gulsharan-pv
I am not using this library now but I think this would work.
Also, see this #28

from socket.io-client-java.

agusgambina avatar agusgambina commented on July 17, 2024

First of all thank you for this great library.

I want to know if I am able to add custom parameters in the client for the handshake like I do with socket.io, I do this

var socket = io('http://SERVER_URL:3000/socket', {query: user});

where user is an json object with data,

Thank you

from socket.io-client-java.

nkzawa avatar nkzawa commented on July 17, 2024

@agusgambina you can do the same:

IO.socket("http://SERVER_URL:3000?userid=100");

from socket.io-client-java.

agusgambina avatar agusgambina commented on July 17, 2024

Excelent, sorry my bad, thank you! works great!

from socket.io-client-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.