This is a functional CC API and server (not CC) that allows for instant communication over http using socket sorcery to handle requests
the server is completely written in Lua and requires just LuaSocket to function
Linux/Mac: try "apt-get install luarocks" if not then get it from http://www.luarocks.org/en/Download then do "luarocks install luasocket"
Windows: https://code.google..../luaforwindows/ has everything you need
if someone wants to attempt to make this in php please do, because people say it would be easier though from what i can tell by how php works this would be hard to do
_______________________________________________________________________________________________________________________________________________________________________________
local h=httpnet.new([host[,port[,id]]])
host is the IP of the server, defaults to "localhost"port is the port, defaults to 1337
id is used in :send, it will also open the channel
event httpnet_message h.uid channel returnchannel data
like modem_message, see h.uid below
h:open(...)
will open all channels specified
h:close(...)
will close all channels specified
h:close()
will close all channels
h:transmit(chan,reurnchan,data)
like modem.transmit
h:send(chan,data)
will send data to chan, using the id specified in .new as the returnchan
h:get([timeout])
waits for the "httpnet_message" event and returns it
h.isOpen[chan]
tells you if chan is open, do not set directly, use :close and :open
h.uid
a secret random hex string, use to filter events
h:exit()
do this after you are done
h:loadplugin(path,...)
loads a pluginSpoiler
| HTTPNet client plugin |
required on the top of of each plugin to make sure it is not ran by anything other than httpnet
handle
the instance that called :loadplugin
name="foo"
specifies the name of the plugin, this must be the same name as the server plugin for them to communicate
function apievent(...)
called when the server plugin triggers an event
apicall(...)
calls the server plugin function
function unload(...)
called when the plugin gets unloadedsee example api
| HTTPNet server plugin |
required on the top of of each server plugin
name="foo"
specifies the name of the plugin
function apicall(uid,...)
see above
apievent(...)
calls the client plugin function- no known bugs
_______________________________________________________________________________________________________________________________________________________________________________
- DOS protection on server
- uid collision detection (currently a 1 in 18446744073709551616 chance so isnt much of a problem)
- auto updater
- more config options on server
- more client functions
- get contributors on github
Spoiler
if you are having trouble, try contacting me on #pixel before posting here