Hi lists, I'm trying to get Amber and Pharo to talk to each other by using Ajax. So far, using an Ajax wrapper that Laurent wrote, I managed to get Pharo to receive a message from Amber by doing:
|ajax| ajax := (Ajax url: 'http://localhost:4001/amber/'). ajax options at: 'type' put: 'POST'; at: 'data' put: 'Hi Pharo!'; at: 'timeout' put: 500. ajax onSuccessDo: [console log: 'ok!']; onErrorDo: [console log: 'not so ok...']. ajax send This is captured by a Swazoo resource, that does the following: answerTo: aRequest | response | [aRequest postData stream anyDataReady] whileTrue: [Transcript show: aRequest postData stream next]. response := HTTPResponse ok. response contentType: 'text/plain'; entity: 'Done!'. ^response My intention here is just to read the message data and return an OK response, but for some reason stream anyDataReady keeps evaluating to true even when there's no more data to read, so the code underneath is never executed. The Transcript shows 'Hi Pharo!' though, so I'm sure the request is being received and read. Any light shed on this would be of great help... Thanks! -- Bernat Romagosa.
