hi Ivyteam,

I just created a websocket API by java in Ivy.

Here is my example:

import java.io.IOException;

import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

@ServerEndpoint("/echo")
public class EchoWebSocket {
    @OnOpen
    public void onOpen(Session session) {
        System.out.println("onOpen::" + session.getId());        
    }
    @OnClose
    public void onClose(Session session) {
        System.out.println("onClose::" +  session.getId());
    }

    @OnMessage
    public void onMessage(String message, Session session) {
        System.out.println("onMessage::From=" + session.getId());

        try {
            session.getBasicRemote().sendText(message.toUpperCase());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @OnError
    public void onError(Throwable t) {
        System.out.println("onError::" + t.getMessage());
    }
}

I don't know how to access to this endpoint in Ivy like "http://localhost:8081/ivy/echo"? Please give me the feedback soon!

Thanks and best regards

Cuong Phan

asked 24.10.2018 at 08:43

cuongphan's gravatar image

cuongphan
(suspended)
accept rate: 0%


Hi

At the moment we do not support this in an IvyProject. You have to make a jar and put it to the webapps/ivy/WEB-INF/lib directory.

link

answered 30.10.2018 at 08:39

SupportIvyTeam's gravatar image

SupportIvyTeam ♦♦
1.4k102118122
accept rate: 77%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×78
×52

Asked: 24.10.2018 at 08:43

Seen: 1,571 times

Last updated: 30.10.2018 at 08:39