SpiderBasic as server-side language?
SpiderBasic as server-side language?
Are there any plans to develop a server-side variant of SpiderBasic?
Re: SpiderBasic as server-side language?
For now the sever-side programs can be done with PureBasic, the big brother of SpiderBasic. v5.40 will feature CGI and FastCGI support, so it should fir the needs for a fast server-side program.
Re: SpiderBasic as server-side language?
Thanks! That's great.
Re: SpiderBasic as server-side language?
Good luck finding a HTTP web host that will allow long-polling or sockets and doesn't have scale-killer metering.
You don't have socket support in SB either.
I actually know how to do websockets in SB using escapes and callbacks but can't be bothered to spend days writing and testing it. I went with a PB client for my multiplayer game till I can sub out work in some app language because I have a job that eats time right now.
You don't have socket support in SB either.
I actually know how to do websockets in SB using escapes and callbacks but can't be bothered to spend days writing and testing it. I went with a PB client for my multiplayer game till I can sub out work in some app language because I have a job that eats time right now.
Re: SpiderBasic as server-side language?
To get going with server programming together with SB I'd recommend Node.JS as a server platform:
Basic steps needed:
It's very easy to extend the main.js with url-handlers so that you can use HTTPRequest from SB and get results from server side, but I'll leave that as an exercise to you. (Google some examples/tutorials from the Express JS web site)
Someone mentioned web hosting, and I'd recommend using one that explicitly supports Node.JS if you go this path. Then "Long running process" is no problem.
main.js
Basic steps needed:
- Go to https://nodejs.org/en/
- Download Node.JS for your OS and Install (there are versions for every OS SB supports)
- Create an empty directory for your Node.JS project somewhere
- Go to the directory
- type "npm init" <press enter> and just accept all defaults (<press enter> some more)
- type "npm install express --save" <press enter>
- create a file called "main.js" with the code I provided below.
- create another directory called "sbclient" inside the Node.JS project directory (Node will serve static files, that is: your SB program, from here)
- create an empty file in this directory called "index.html"
- Open compiler options in SB and point your export settings "HTML filename" to the index.html file in the "sbclient" directory you just created.
- Make sure you check the checkbox called "Copy SpiderBasic libraries"
- Close the compiler options dialog with OK-button
- In SB menu use "compiler"->"export" (the "sbclient" library should now be populated with your project.)
- Go back to the Node.JS directory with terminal (OS X/Linux) or cmd.exe (Windows)
- Type "node main.js" <press enter>
- In your web browser write the address: "localhost:3000" <press enter>
- (If you want to stop the server (or restart it after making changes) Press CTRL+C)
It's very easy to extend the main.js with url-handlers so that you can use HTTPRequest from SB and get results from server side, but I'll leave that as an exercise to you. (Google some examples/tutorials from the Express JS web site)
Someone mentioned web hosting, and I'd recommend using one that explicitly supports Node.JS if you go this path. Then "Long running process" is no problem.
main.js
Code: Select all
var express = require('express')
var app = express()
app.use(express.static(__dirname + '/sbclient'));
var server = app.listen(3000, function() {
a = server.address();
console.log('App listening at http://%s:%s', a.address, a.port);
})
Re: SpiderBasic as server-side language?
This is great info, thanks !