Giter VIP home page Giter VIP logo

discpp's Introduction

discpp

A C++ API wrapper library for the Discord bot API, aiming to be fast and lightweight using modern C++ practices. Whether those aims will be met, no one knows :)

Disclaimer: the library is not at all stable. Hopefully a roadmap is going to be made soon.

Dependencies

The library currently requires C++14, and the following third-party dependencies (as well as their transitive dependencies).

  • (not-yet-)boost::json
  • boost::beast >=1.68
  • boost::log
  • cmake (and some build tool like make or ninja)

Contributing

Issues are currently only publically tracked using the GitHub issue tracker. If you encounter any issues, or want to offer tips or suggestions, feel free to drop a line there or email me.

discpp's People

Contributors

greenbagels avatar

Watchers

 avatar  avatar  avatar

discpp's Issues

Basic Feature Completion

A lot of functionality isn't yet included into the library, such as creating messages, diagnostic info, etc. We should aim to provide these features before we hit our first target version release.

Websocket loop deadlocks

The connection::main_loop() function has a logic error; currently, it does this:

  1. Read from the websocket
  2. Execute the read handler
  3. Wait until all outstanding threads finish their execution
  4. Empty the write queue and repeat

The third step was a stop-gap solution to fix the blocking issue. To reproduce the issue, simply do the following:

  1. Connect to guilds that are not currently sending any events (i.e. no server activity at all)
  2. Wait a length of heartbeat_interval ms
  3. Observe as the pending heartbeat is deadlocked by a blocking read().

Obviously, the way the loop is set up needs to change. Realistically, we can't be waiting on read() ever, or else any lack of incoming data will deadlock any recurring writes. Doesn't this mean async is our only other option?

Lacking Proper Interface For Message Reading

This is related to #3 in that we need to not have the connection class manage all the parsing itself.

For now, I think we can settle on having the connection class parse all input to nlohmann::json objects, selectively respond to initial connection / keepalive data, and pass everything else along to the next library layer.

Decide on a copyright notice scheme

Currently we just include the example copyright notice straight from GNU's website in each source file. Perhaps this is not a great system, as we can just switch to doxygen-style \copyright notices, which would also give us doxygen-based documentation?

Declassify

I fear we haven't properly thought about the scope of our project when we first made it, and coupled too much functionality into the discpp::connection class.

A lot of library functionality (like get_gateway) doesn't need to explicitly reference an active WebSocket connection, so let's cut out the extra stuff.

Current Implementation is Not Exception Safe

We should aim to supply exception safety guarantees for each of our functions we offer in the class. Currently, we've supplied it for none of them, but we should definitely implement it for all of them (even if only a basic guarantee)

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.