Registering a Printer (Privet)

570 views
Skip to first unread message

Brenden Larson

unread,
Jun 16, 2014, 3:03:36 PM6/16/14
to gcp-dev...@googlegroups.com
I currently have a python script that is announcing itself as a printer (_privet._tcp and _printer._sub._tcp) over DNS-SD and it shows up under chrome://devices. After clicking register and confirming that I want to register the printer it very briefly says "You must confirm registration on your printer to finish this process - check it now", but then says "An error has occured. Please check your printer and try again." I have an HTTP request handler that handles all of the Privet APIs, including /privet/info, but the problem is that there is no HTTP request of any sort sent to the handler. I know this because I have a print statement at the top of each type of request handler (HEAD, GET, POST). Is there a reason it might not be sending HTTP requests? Some other information about the configuration is that I have the request handler on the localhost with port 5222 and DNS-SD is setup over port 5222 as well. I read that XMPP is involved with Privet, but this hasn't been implemented in my python printer script yet. Is an XMPP connection established before any HTTP requests are sent?

Gene Gutnik

unread,
Jun 16, 2014, 5:40:12 PM6/16/14
to gcp-dev...@googlegroups.com
Hi Brenden,
Quick note, it should be _printer._sub._privet._tcp for the second mDNS PTR record. It should not matter for your issue.
Before we display "Register" button in chrome://devices, Chrome will send /privet/info HTTP request to your webserver. Do you see this request? You can start WireShark to get a network dump. Request target (IP and port) are received from mDNS SRV and A records. (most likely it will be port 80).
To start registration, Chrome will call /privet/register?action=start API. They it will keep calling /privet/register?action=getClaimToken to receive claim token from the printer.


On Mon, Jun 16, 2014 at 12:03 PM, Brenden Larson <blasterm...@gmail.com> wrote:
I currently have a python script that is announcing itself as a printer (_privet._tcp and _printer._sub._tcp) over DNS-SD and it shows up under chrome://devices. After clicking register and confirming that I want to register the printer it very briefly says "You must confirm registration on your printer to finish this process - check it now", but then says "An error has occured. Please check your printer and try again." I have an HTTP request handler that handles all of the Privet APIs, including /privet/info, but the problem is that there is no HTTP request of any sort sent to the handler. I know this because I have a print statement at the top of each type of request handler (HEAD, GET, POST). Is there a reason it might not be sending HTTP requests? Some other information about the configuration is that I have the request handler on the localhost with port 5222 and DNS-SD is setup over port 5222 as well. I read that XMPP is involved with Privet, but this hasn't been implemented in my python printer script yet. Is an XMPP connection established before any HTTP requests are sent?

--
You received this message because you are subscribed to the Google Groups "Google Cloud Print Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gcp-developer...@googlegroups.com.
Visit this group at http://groups.google.com/group/gcp-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/gcp-developers/05ac42b8-4052-419f-8aeb-10704d558030%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brenden Larson

unread,
Jun 16, 2014, 7:29:28 PM6/16/14
to gcp-dev...@googlegroups.com
Hi Gene,
Sorry the _printer._sub._tcp was just a typo in my post. It is _printer._sub._privet._tcp in the script. 
No, I don't get any HTTP requests to my server even when I restart the server and refresh the webpage to get new devices. I used WireShark to verify that no HTTP traffic was being sent anywhere. In fact, the only HTTP protocol listings state "Continuation or non-HTTP traffic." Even though no HTTP request gets sent to my server the register button in Chrome shows up. Is there a reason it isn't making any HTTP requests?

Brenden Larson

unread,
Jun 19, 2014, 1:46:59 PM6/19/14
to gcp-dev...@googlegroups.com
Ok, so I figured out the issue with not receiving HTTP requests, but now I'm having another problem during registration. The scenario I'm working with is a purely offline situation with no connection to the internet. I get the call to /privet/register?action=start&user=mye...@gmail.com and send back the action and user in the JSON response, this part works fine. When I receive the follow up request to /privet/register?action=getClaimToken&user=mye...@gmail.com I reply with the following in the HTTP response's JSON body:

{ 'action': 'getClaimToken', 
  'token': 'AAA111222333444555666777', 
  'user': 'myemail%40gmail.com', 
}

However, this causes Google Chrome to claim that the printer had an error and it proceeds to send a cancel request.

I also tried the response with

{ 'action': 'getClaimToken', 
  'token': 'AAA111222333444555666777', 
  'user': 'myemail%40gmail.com', 
  'automated_claim_url': 'http://isthisrequired.com/imnotsure'
}

and this also caused Chrome to claim that there was an error.

What is incorrect here, and how can I solve this in an entirely offline scenario?

On Monday, June 16, 2014 2:40:12 PM UTC-7, gene wrote:

Gene Gutnik

unread,
Jun 19, 2014, 3:14:09 PM6/19/14
to gcp-dev...@googlegroups.com
Hi Brenden,
Registration process associate this printer with Google user at the Google server. It will work ONLY when printer/client are online.
If you like your printer to be usable OFFLINE, you don't have to do registration at all. All you need is to express /privet/printer/submitdoc (and /createjob if you like) in the /privet/info API. Then use Chrome print dialog and click select printer. During the printer selection, Chrome should do printer discovery and list all printers supporting offline operations.


Reply all
Reply to author
Forward
0 new messages