0
votes

I am having trouble with socket.io java.

I am using "Compiler Compliance Level 11" in ubuntu 20.04

This is my code:

import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import java.net.URISyntaxException;

public class main {
    protected Socket getSocket(){
        Socket mSocket;
        try {
            mSocket = IO.socket(".....uri.....");
            mSocket.on("hello", new Emitter.Listener() {
                @Override
                public void call(Object... args) {
                    System.out.println(args[0]); // world
                }
            });
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        return mSocket;
    }
    
    public static void main(String[] args) {
        
        
    }

}

And this is error:

The method call(Object...) of type new Emitter.Listener(){} must override a superclass method