electronic.alchemy :: Breakpointing
electronic.alchemy
where the past meets the future
pike > Fins > Developer > Breakpointing

Breakpointing

Created by hww3. Last updated by hww3, 14 years ago. Version #2.

Fins supports request breakpointing, which allows you to pause a request in flight and query and modify it.

To enable breakpointing, add the following to your application's configuration file:

[application]
breakpoint=1
breakpoint_port=12345

Then when you restart your app, you should see a line that says the breakpoint server is being started. Once you see that, you can telnet to that port:

bash-2.05$ telnet buoy.riverweb.com 12345
Trying 204.97.242.43...
Connected to buoy.riverweb.com.
Escape character is '^]'.
Welcome to Fins Breakpoint Service.

Now, it's just waiting for a request to hit a breakpoint. To add a breakpoint, you add something like this in your controller's event:

  app->breakpoint("some description", (["id": id, "response": response ]));

...and when your app hits that point, your telnet session will come alive with a hilfe prompt. You can access the request object as "id" and the response as "response". You can access request variables and change the response (though if code later on in the request modifies it, your changes may be overwritten.)

For example:

Welcome to Fins Breakpoint Service.
Breakpoint on test
> id;
(1) Result: Fins.HTTPRequest("GET" "/space/start/2006-04-25/2")
> id->variables;
(2) Result: ([ ])
> id->misc;
(3) Result: ([ /* 5 elements */
              "_session": Session(6d5581d44dab127d7fb1, ([ ])),
              "current_page": "start/2006-04-25/2",
              "current_page_object": object(230),
              "session_id": "6d5581d44dab127d7fb1",
              "session_variables": ([ ])
            ])
> id->misc->current_page_object["title"];
(4) Result: "Collaborative editing for Mac: on sale, too!"
> go
Resuming.

The only limitation to using breakpoints is that it uses threads. Not a big deal, just something to be aware of.

Not categorized | RSS Feed | BackLinks

comments powered by Disqus