Search in sources :

Example 1 with ChannelBroadcastMessage

use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.

the class VfsWatchBroadcaster method onEvent.

@Override
public void onEvent(VfsWatchEvent event) {
    try {
        final ChannelBroadcastMessage bm = new ChannelBroadcastMessage();
        bm.setChannel(VfsWatchEvent.VFS_CHANNEL);
        bm.setBody(DtoFactory.getInstance().toJson(event));
        WSConnectionContext.sendMessage(bm);
    } catch (Exception e) {
        LOG.error(e.getLocalizedMessage(), e);
    }
}
Also used : ChannelBroadcastMessage(org.everrest.websockets.message.ChannelBroadcastMessage)

Example 2 with ChannelBroadcastMessage

use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.

the class InitializeEventMessenger method send.

protected void send(final LanguageServerInitializeEventDto message) {
    try {
        final ChannelBroadcastMessage bm = new ChannelBroadcastMessage();
        bm.setChannel("languageserver");
        bm.setBody(new Gson().toJson(message));
        WSConnectionContext.sendMessage(bm);
    } catch (EncodeException | IOException e) {
        LOG.error(e.getMessage(), e);
    }
}
Also used : ChannelBroadcastMessage(org.everrest.websockets.message.ChannelBroadcastMessage) Gson(com.google.gson.Gson) EncodeException(javax.websocket.EncodeException) IOException(java.io.IOException)

Example 3 with ChannelBroadcastMessage

use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.

the class PublishDiagnosticsParamsMessenger method onEvent.

public void onEvent(final PublishDiagnosticsParams event) {
    try {
        if (event instanceof PublishDiagnosticsParamsImpl && event.getUri().startsWith("file:///projects")) {
            ((PublishDiagnosticsParamsImpl) event).setUri(event.getUri().substring(16));
        }
        final ChannelBroadcastMessage bm = new ChannelBroadcastMessage();
        bm.setChannel("languageserver/textDocument/publishDiagnostics");
        bm.setBody(new Gson().toJson(event));
        WSConnectionContext.sendMessage(bm);
    } catch (EncodeException | IOException e) {
        LOG.error(e.getMessage(), e);
    }
}
Also used : ChannelBroadcastMessage(org.everrest.websockets.message.ChannelBroadcastMessage) Gson(com.google.gson.Gson) EncodeException(javax.websocket.EncodeException) PublishDiagnosticsParamsImpl(io.typefox.lsapi.impl.PublishDiagnosticsParamsImpl) IOException(java.io.IOException)

Example 4 with ChannelBroadcastMessage

use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.

the class GitWebSocketMessenger method onEvent.

@Override
public void onEvent(GitCheckoutEvent event) {
    try {
        final ChannelBroadcastMessage bm = new ChannelBroadcastMessage();
        final String channel = String.format(CHANNEL, event.getWorkspaceId(), event.getProjectName());
        bm.setChannel(channel);
        bm.setBody(DtoFactory.getInstance().toJson(event));
        WSConnectionContext.sendMessage(bm);
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
    }
}
Also used : ChannelBroadcastMessage(org.everrest.websockets.message.ChannelBroadcastMessage)

Example 5 with ChannelBroadcastMessage

use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.

the class DebuggerWebSocketMessenger method onEvent.

@Override
public void onEvent(DebuggerMessage msg) {
    try {
        final ChannelBroadcastMessage bm = new ChannelBroadcastMessage();
        final String channel = String.format(CHANNEL, msg.getDebuggerType());
        bm.setChannel(channel);
        bm.setBody(DtoFactory.getInstance().toJson(asDto(msg.getDebuggerEvent())));
        WSConnectionContext.sendMessage(bm);
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
    }
}
Also used : ChannelBroadcastMessage(org.everrest.websockets.message.ChannelBroadcastMessage)

Aggregations

ChannelBroadcastMessage (org.everrest.websockets.message.ChannelBroadcastMessage)14 IOException (java.io.IOException)5 EncodeException (javax.websocket.EncodeException)4 Gson (com.google.gson.Gson)3 JsonObject (com.google.gson.JsonObject)1 PublishDiagnosticsParamsImpl (io.typefox.lsapi.impl.PublishDiagnosticsParamsImpl)1