r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!Cheyenne] Discussions about the Cheyenne Web Server

ddharing
5-Oct-2011
[10835x2]
FYI: I've been doing some web sockets testing with Cheyenne. It seems 
that the specification is still a fast moving target. The browsers 
are trying to keep up, but server implementations (like Cheyenne) 
are breaking. For example, the Cheyenne web socket samples work with 
Chrome 12 on Ubuntu, but not with Chrome 14 or Safari 5.1 on Windows. 
I'm going to try the iPad tomorrow.
A good site to test web socket support in your browser is http://websocketstest.com.
It will even show the specification draft that your browser supports. 
It's different in Chrome 12 and Chrome 14.
Kaj
5-Oct-2011
[10837]
Thanks, good info
Endo
5-Oct-2011
[10838]
http://www.websocket.org/is also a good site, it has good info 
about websockets.

by the way, if you use Opera Web Browser and want to test websockets, 
type opera:config to address bar, then type websocket to the search 
box and click on Enable WebSockets.
ddharing
5-Oct-2011
[10839]
Endo, thanks for the Opera info. I did not know that and could not 
get Opera to work today.


BTW, I don't think that websocket.org is keeping up. Like Cheyenne, 
I can't get Chrome 14 or Safari 5.1 on Windows to run the Echo test. 
Does it work for you? I tried 4 Windows machines running XP and Vista.
Endo
6-Oct-2011
[10840]
Hmm it is strange I just tested the echo test on the http://www.websocket.org/
site when I post the message above and it was working. I test it 
with Maxthon 3 browser. But now it doesn't work with either Opera 
 nor Maxthon..
Kaj
6-Oct-2011
[10841]
It doesn't work with Firefox, either
amacleod
17-Oct-2011
[10842x4]
<?php
$contact = array("name" => "Ben");
$contact_encoded = json_encode($contact);
header('Content-type: text/html');
echo $_GET['callback'] . "(" . $contact_encoded . ")";
?>
Anyone know the rebol equivalent to the above code?
And would it work in cheyenne?
I most interested in the call back line to send json encoded data...i 
can't get a jquery script to accept anything I send back
ChristianE
17-Oct-2011
[10846x2]
If you want to send JSON, you'd better set an apropriate MIME media 
type with e.g.

<% response/set-header 'Content-Type "application/json" %>


Cheyenne has no JSON converter, but you'll find something at http://www.ross-gill.com/page/JSON_and_REBOL
.
And maybe it's a good idea to try to serve some static JSON data 
first instead of generated data to narrow down where the problems 
are.
amacleod
17-Oct-2011
[10848]
Christian, The data in eh browser looks right now...thanks, but teh 
jquery script is still not working. I believe it has to do with the 
callback or lack there of ...
Gabriele
18-Oct-2011
[10849]
that seems to be returning javascript (ie. a call to a JS function), 
rather than JSON...
Andreas
18-Oct-2011
[10850]
(Which some people call JSONP.)
amacleod
18-Oct-2011
[10851]
The javascript is looking for the data in a callback...how do I wrap 
the data in a callback using rebol and cheyenne?
Gabriele
19-Oct-2011
[10852x2]
just return the Javascript call, like the PHP does above.
ie. if the function is called "myFunction", just return "myFunction({myData: 
1, ...})"
amacleod
19-Oct-2011
[10854]
Thanks for the response Gabriele, but I just can't get this to work.
If i'm using an rsp page to send back the request:
I've got this:
<%
data: {
one
: "Singular sensation",
two
: "Beady little eyes",
three
: "Little birds pitch by my doorstep"
}
response/set-header 'Content-Type "application/json"
print rejoin ["myfunc" "({" data "})"]
%>

Does not work...

response in web page includes the function name which does not look 
like json data typically served back
GrahamC
19-Oct-2011
[10855]
This works for me

	response/buffer: copy data
	response/set-header 'Content-type "application/json"
amacleod
19-Oct-2011
[10856]
Graham! You are the best...thanks again!


I had to use echo mode on the client (and i'm not really sure what 
that means) but it works!
GrahamC
19-Oct-2011
[10857x2]
Glad it works ...
More correctly Nenad is the best ...
Ryan
6-Nov-2011
[10859]
Can Cheyenne do SSL?
Dockimbel
6-Nov-2011
[10860]
Not standalone, you would need a SSL front-end for that, like stunnel 
or nginx.
Ryan
11-Nov-2011
[10861]
Cheyenne-server.org is taking a long while to serve the wiki pages.
Dockimbel
11-Nov-2011
[10862x2]
Main PHP process froze. I'm restarting it.
Done.
Janko
12-Nov-2011
[10864x3]
btw: I added few lines to cheyenne so it solves my only major hurdle 
with javascript (I need to write a lot of javascript for my apps, 
and I use sort of functional style). shorter syntax for anonymouse 
functions + returns. Nothing big or complex...
f{ a, b | .... }  ==>  function ( a, b ) { ..... } 
r{ a, b | a + b } ==> function ( a, b ) { return a + b } 

not sure if it's usefull to anyone else or has place in real cheyenne, 
since it's just more of a hack (and not standard in any way). If 
anyone need it, let me know)
I just added few lines to parse where it compiles in it's multilang 
stuff - which is btw very good since it does it only once and then 
holds cached version same as for languages :)
nenad designed cheyenne very well, that's why it's so fast!
Kaj
17-Nov-2011
[10867x2]
Here's inspiration for Cheyenne/Red:
http://gwan.ch/
Dockimbel
18-Nov-2011
[10869x3]
I am not sure that web developers are ready to jump to C for writing 
their server-side scripts (especially with error reports that include 
CPU registers content :-) ).
The main benchmark graph is basically testing how fast each server 
is able to copy chunks of memory. ;-)
http://gwan.ch/benchmark
Also, this is closed source software.
sqlab
18-Nov-2011
[10872]
I tried gwan on Windows with a logs directory as described in the 
manual. It crashed.
Also the listen options on startup did not work.
Kaj
18-Nov-2011
[10873x2]
Copying chunks of memory is what you do when serving static files, 
isn't it?
Cheyenne/Red doesn't have to be closed source and write scripts in 
C
Dockimbel
18-Nov-2011
[10875]
Yes, especially when you're serving only to localhost (like in the 
gwan benchmark).
Kaj
18-Nov-2011
[10876]
The main point is that G-WAN basically uses the BeOS/Syllable architecture: 
one process with worker threads
Dockimbel
18-Nov-2011
[10877]
That's what I plan to do too for Red.
Kaj
18-Nov-2011
[10878]
Specifically, it uses a pool of one thread per core for an event 
based architecture
Dockimbel
18-Nov-2011
[10879]
That's the only rational way to use threads IMO too.
Kaj
18-Nov-2011
[10880x2]
Well, there you have it: the other web servers don't
Sqlab, G-WAN for Windows is discontinued, a year ago or so
sqlab
18-Nov-2011
[10882]
Yes, but I just used the examples as they are explained in the manual 
for the windows version.
Kaj
18-Nov-2011
[10883x2]
It seems to have been developed on Server 2003. Maybe it doesn't 
work on newer Windows versions. It was discontinued in September 
2009
That was probably when G-WAN had been in development for a year, 
so in any case it would be incomparable to the current Linux version, 
which is not mature yet, either