~dustin-spy/twisted/dustin

« back to all changes in this revision

Viewing changes to emacs/pbechoclient.el

  • Committer: jml
  • Date: 2006-04-10 12:52:37 UTC
  • Revision ID: vcs-imports@canonical.com-20060410125237-d7c0c08e21af5433
Add TwistedEmacs to Twisted (with improved docs)

Author: jml
Reviewer: radix
Fixes #1628

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(require 'pb)
 
2
 
 
3
(defvar pbecho-buf (get-buffer-create "*pbechoclient*"))
 
4
 
 
5
(defun success (echo)
 
6
  (print (format "Message received: %s" echo) pbecho-buf)
 
7
  ;; (pb-shutdown broker) surprise!!
 
8
  )
 
9
(defun failure (error)
 
10
  (print (format "failure: %s" reason) pbecho-buf)
 
11
  (pb-shutdown broker))
 
12
(defun connected (perspective)
 
13
  (funcall perspective "echo" '("hello world") nil #'success #'failure)
 
14
  (print "connected." pbecho-buf))
 
15
 
 
16
(pb-connect #'connected #'failure "localhost" pb-port "guest" "guest" "pbecho" "guest" nil 30)
 
17
 
 
18
(delete-process "pb")