-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from anthdm/js-resp
Js resp
- Loading branch information
Showing
11 changed files
with
249 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,32 @@ | ||
// This should come from the official SDK. | ||
// This should come from the official SDK. | ||
// But there is no official SDK yet, so we keep it here. | ||
function hexLog(s) { | ||
for (let i = 0; i < s.length; i++) { | ||
putstr(s.charCodeAt(i).toString(16).padStart(2, "0")) | ||
} | ||
putstr("0a") | ||
} | ||
|
||
console.log = hexLog | ||
|
||
function respond(res, status) { | ||
console.log(res) | ||
console.log(status) | ||
var buffer = new ArrayBuffer(8); | ||
var view = new DataView(buffer); | ||
view.setUint32(0, status, true); | ||
view.setUint32(4, res.length, true); | ||
|
||
for (let i = 0; i < res.length; i++) { | ||
putstr(res.charCodeAt(i).toString(16).padStart(2, "0")) | ||
} | ||
for (let i = 0; i < view.buffer.byteLength; i++) { | ||
putstr(view.getUint8(i).toString(16).padStart(2, "0")); | ||
} | ||
} | ||
|
||
console.log("user log here") | ||
console.log("user log here") | ||
console.log("user log here") | ||
console.log("user log here") | ||
console.log("user log here") | ||
|
||
respond("<h1>From my Raptor application</h1></br>some other stuff here</br>", 200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package actrs | ||
|
||
import ( | ||
"github.com/anthdm/hollywood/actor" | ||
"github.com/anthdm/raptor/internal/types" | ||
) | ||
|
||
const KindRuntimeLog = "runtime_log" | ||
|
||
type RuntimeLog struct{} | ||
|
||
func NewRuntimeLog() actor.Receiver { | ||
return &RuntimeLog{} | ||
} | ||
|
||
func (rl *RuntimeLog) Receive(c *actor.Context) { | ||
switch msg := c.Message().(type) { | ||
case actor.Started: | ||
case actor.Stopped: | ||
case types.RuntimeLogEvent: | ||
_ = msg | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.