Git Product home page Git Product logo

Comments (4)

rampatra avatar rampatra commented on May 18, 2024

Can you please send me the logs. I don't think larger text would be the issue, it rather seems to be an exception in your code. I too faced such issue but later I figured out that there was an exception in my bot (the bot which I made using jbot and not jbot itself) code.

from jbot.

thirunar avatar thirunar commented on May 18, 2024

The problem, there was no exception when the bot goes offiline. I'm attaching the code, let me know, if this helps

    @Controller(events = {EventType.DIRECT_MENTION, EventType.DIRECT_MESSAGE})
    public void onReceiveDM(WebSocketSession session, Event event) {
        LOGGER.info("Received: {}", event.getText());

        String response = formatCode(requestProcessor.processRequest(event.getText()));
        reply(session, event, new Message(response));
        stopConversation(event);
    }

RequestProcessor.processRequest

    public String processRequest(String request) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = createHeaders("admin", "xyz");
        String url = getUrl(request);
        if (url != null) {
            if (request.contains("livenodes")) {
                HttpEntity entity = new HttpEntity(headers);
                ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
                return response.getBody();
            } else {
                headers.setAccept(asList(MediaType.APPLICATION_XML));
                HttpEntity entity = new HttpEntity(headers);
                try {
                    ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
                    return PrettyPrinter.formatXML(response.getBody());
                } catch (Exception e) {
                    return "Sorry!! Error processing the request!!!";
                }
            }
        }
        return "";

    }

And also, it would be helpful, if you can share what exception you faced in your bot

from jbot.

ldavison avatar ldavison commented on May 18, 2024

See the limits section for RTM. It specifically says:

The message server will disconnect any client that sends a message longer than 16 kilobytes. This includes all parts of the message, including JSON syntax, not just the message text.

from jbot.

thirunar avatar thirunar commented on May 18, 2024

Thanks a lot!! This helps. I split the message into small chunks.

from jbot.

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.