Web chat, Chat from a website

Discussion in 'Plugin Development' started by mrsamcraft, Dec 18, 2013.

Thread Status:
Not open for further replies.
  1. Hello,

    So I'm wanting to create a chat plugin that allows users to chat from a website. How would I go about doing this?


    Thanks,
    Sam
     
  2. Offline

    NathanWolf

    You could take a look at dynmap's code :)

    You'd basically need to implement or embed a web server in your plugin. This server would listen for specific HTTP requests (using JSON back and forth is probably a good idea).

    Your server would need to accept incoming chat requests and broadcast them in-game, and also track all in-game chat messages and "broadcast" them to the web. This part gets tricky, you don't really send to a website, the website polls - so you'll have to keep a message history and the website either asks for the last "N" messages, or the last messages since the last one it received (using some identifier that you would manage).

    Unless there's some library out there that does all this for you, it's going to be a pretty big project :)

    Take a look at Jetty if you want a Maven-friendly embedded web server.

    And I was serious about looking at dynmap's code, it does exactly this.
     
    mrsamcraft likes this.
  3. Thanks for the fast reply!
    I'll have a shot at this! If i get this working Ill let you know!

    Thanks! ~Sam
     
Thread Status:
Not open for further replies.

Share This Page