Giter Club home page Giter Club logo

Comments (6)

alexsaveliev avatar alexsaveliev commented on July 30, 2024

@vkurland please switch to updated version com.codeminders.socketio:socket-io:1.0.3 we have released yesterday. I have tried chat demo with Jetty 9.4.7 RC0 and it works fine

from socket.io-server-java.

vkurland avatar vkurland commented on July 30, 2024

It looks like your API has changed. I used to use your class JettySocketIOServlet but I can't find it anymore. How do I build a servlet to handle Socket-IO connections? In my application, I need this to be a part of existing web server that has lots of other servlets and serves everything on the same port

from socket.io-server-java.

alexsaveliev avatar alexsaveliev commented on July 30, 2024

Please use com.codeminders.socketio.server.transport.websocket.WebsocketIOServlet instead of former
JettySocketIOServlet

for example,

public class ChatSocketServlet extends WebsocketIOServlet {
....
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        of("/foo").on(new ConnectionListener() {
            @Override
            public void onConnect(final Socket socket) {
                socket.on("bar", new EventListener() {
                    @Override
                    public Object onEvent(String name, Object[] args, boolean ackRequested) {
                        return "OK";
                    }
                });
                .....
            }
        }
    }
.....
}

You can also catch me on Skype to discuss things, I would be happy to help

from socket.io-server-java.

vkurland avatar vkurland commented on July 30, 2024

this helps, I was able to move onto the next step. Unfortunately, this wasn't enough.

Caused by: java.lang.NoSuchFieldError: WRITE_DURATIONS_AS_TIMESTAMPS
at com.fasterxml.jackson.datatype.joda.ser.DurationSerializer.(DurationSerializer.java:28)
at com.fasterxml.jackson.datatype.joda.ser.DurationSerializer.(DurationSerializer.java:25)
at com.fasterxml.jackson.datatype.joda.JodaModule.(JodaModule.java:43)
at net.happygears.nw2.json.JsonObjectMapperFactory.actuallyCreateMapper(JsonObjectMapperFactory.java:71)
at net.happygears.nw2.json.JsonObjectMapperFactory.createMapper(JsonObjectMapperFactory.java:52)
at net.happygears.nw2.db.hbm.AreaModel.(AreaModel.java:32)
at java.lang.Class.forName0(Native Method)

this has nothing to do with Socket-io but as far as I understand, this error is caused by incompatible versions of jackson-databind and jackson-datatype-joda.

Looks like your library depends on jackson-databind v2.4.0 which is a bit too old and it causes compatibility issues with my code that depends on a newer version.

Is there a particular reason you need the old one? I believe anything newer than 2.5.0 should work for me but as fyi, my pom.xml declares dependency on jackson-core 2.9.0.pr3

pom that comes with your library declares this:

<dependencies>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>javax.websocket</groupId>
        <artifactId>javax.websocket-api</artifactId>
        <version>1.1</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

from socket.io-server-java.

alexsaveliev avatar alexsaveliev commented on July 30, 2024

bumped dependency versions to the latest ones:

  • Guava 23.0
  • Jackson 2.9.1

Please try with snapshot version built from source code

from socket.io-server-java.

vkurland avatar vkurland commented on July 30, 2024

I have worked around this issue by excluding transient dependencies:

    <dependency>
        <groupId>com.codeminders.socketio</groupId>
        <artifactId>socket-io</artifactId>
        <version>1.0.3</version>
        <exclusions>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

looks like your server works for me now, thank you

from socket.io-server-java.

Related Issues (11)

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.