ID:2501938
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Having websockets into DM would be a nice thing for real time UI updating as it would be way less overhead to send some data over a websocket than to either inject a script in the page to send the data(calling browse("output=browser:script") does that) or to create a whole new browser to do so.Notes that websockets transmit in either UTF-8 or in direct binary data,the later which probably should be disallowed in BYOND since BYOND doesnt exactly have what it needs to be able to manipulate binary data without one revolting against society as a whole

Would suggest a syntax like this:

for receiving data
/world/SocketReceive(data)
//does stuff with the data
if(findtext(data,"computer_",1,2)

for sending the string "computer_dog" on the socket
world.sendSocket("computer_dog")

for opening a socket on port 1234
world.openSocket(1234)
Would a second connection really be "less overhead" than the current technique of commanding the client to invoke a JS callback with some data?

Websockets specifically are only necessary if you want to communicate with JS running in a browser. In any other environment you can just use regular sockets.
I should also point out that you can use ajax in byond clients but can not receive response.

A better solution would be to just allow topic to return a value that is sent to the client during ajax requests
In response to MrStonedOne
MrStonedOne wrote:
I should also point out that you can use ajax in byond clients but can not receive response.

A better solution would be to just allow topic to return a value that is sent to the client during ajax requests

Ooh! I'll look into that.

Feasibility might depend on how the request is currently handled. IIRC it doesn't wait.
In response to MrStonedOne
It appears allowing an AJAX response here is a tricky beast indeed.