grapenut / mush-portal

An integrated web platform for PennMUSH servers v1.8.7p0 or higher. Features a web client with fully customizable 256-color terminal emulator designed with a responsive mobile-friendly UI.
http://www.mushportal.com
5 stars 2 forks source link

Server-side events? #1

Closed Balerion300 closed 5 years ago

Balerion300 commented 6 years ago

First, again, great work on this!

Is there any documentation regarding server-side events that should be put in place to make maximal use of the client? I'm guessing these are things related to exits providing the correct information for the GUI-based navigation, and maybe stuff related to the BBs and mail systems?

grapenut commented 6 years ago

I have an softcode object that I call the JSON API. I will @decompile and add it to the repository later this evening. It contains events, commands, functions and hooks for builtins that send JSON back to the client with relevant information. The client can replicate some of this on its own, but the server-side JSON API allows you to have a lot more control and makes the experience seamless. I'll let you know when the softcode is uploaded.

The Mail panel works no matter what.

The BBoard panel requires JSON API, and is only implemented for Myrddin's BBS. It's barebones at the moment, but I plan to make it match the mail reader in looks and functionality.

The Sidebar works about 50% without JSON API. You can regenerate the sidebar content by clicking the look button or using the nav buttons, but that information will not automatically update. With the JSON API it will automatically update any time you move, whether using the buttons, the command-line, or being @teleported. It will also update automatically whenever another player or object leaves/enters. That last bit currently makes use of some changes that have been added to Penn's git recently, but could be easily adapted to work without those changes.

grapenut commented 6 years ago

I've uploaded the JSON API object. I did some last minute clean-up on it, so let me know if you have any trouble. You'll need to be using the latest PennMUSH from github. The OOB() function has been updated to accept a list of targets, which is used to update the rest of the room whenever something moves, connects, or disconnects. If you can't update PennMUSH it's possible to use PEMIT(WSJSON()) instead, but PEMIT() prints a newline so web clients see an annoying blank line every time something moves.

See https://github.com/grapenut/mush-portal/blob/master/jsonapi.mush

Balerion300 commented 6 years ago

Okay, put this place and dropped the object in our master room. I can do something like run jsoinapi/listexits, but it doesn't seem to know that after I move it should update the exits again. What's needed to make that happen?

grapenut commented 6 years ago

It needs to be set as your event handler in mush.cnf

Balerion300 commented 6 years ago

Ah, excellent!