The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2017-06-08

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:03 kiwiroy joined #mojo
00:28 kiwiroy joined #mojo
00:55 kiwiroy joined #mojo
01:17 aborazmeh joined #mojo
01:21 kiwiroy joined #mojo
01:45 tencendur joined #mojo
01:48 kiwiroy joined #mojo
02:09 aborazmeh joined #mojo
02:17 kiwiroy joined #mojo
02:42 noganex joined #mojo
03:29 kiwiroy joined #mojo
03:30 tencendur_ joined #mojo
03:51 aborazmeh joined #mojo
04:04 dboehmer joined #mojo
04:24 cheako joined #mojo
04:55 kiwiroy joined #mojo
05:50 dod joined #mojo
05:56 dod joined #mojo
05:57 inokenty-w joined #mojo
06:21 karjala_ joined #mojo
06:37 tyldis joined #mojo
06:45 AndrewIsh joined #mojo
07:22 trone joined #mojo
07:48 CandyAngel jberger: If you do decide to make this request flow into an article, please let me know. I just read it again this morning and one bit confused me so it might need some light rewording
07:48 * CandyAngel hasn't entirely woken up yet
07:49 prg joined #mojo
08:07 CandyAngel I do wonder if I am looking at the wrong part. Like.. maybe I should be writing based on ::UserAgent
08:45 dod joined #mojo
09:10 rshadow joined #mojo
09:35 rshadow joined #mojo
09:55 CandyAngel Armen: Good example of javascript idiocy here (https://www.purrform.co.uk)
09:55 CandyAngel The navigation uses <a>, but they have no target.. driven by JS
09:55 CandyAngel So they don't work >.<
09:57 CandyAngel Well, the "Buy Online" one doesn't
09:58 CandyAngel That should link somewhere, then if you have JS enabled, it can replace it with the fancy-pants-but-pointless expandy thing
10:02 irqq joined #mojo
10:05 CandyAngel And of all the bits of the page to make not-work without JS, the one that generates income is probably the worst one :P
10:20 sri a diagram for the request flow would be good too
10:23 nic sri: I have a module for importing/exporting between a CookieJar and a cookies.txt file
10:24 nic Am I right to think core is not interested in that functionality?  (this is for choosing a package name)
10:24 nic The working title is Mojo::Cookie::File and now is a good time to come up with its real name for release
10:25 nic perhaps Mojo::UserAgent::CookieJar::File
10:26 nic no, that's misleading
10:26 nic perhaps s/File/Store/
10:28 pink_mist perhaps FileStore
10:28 nic I guess Mojo::Cookie::File is the most intuitive, and if Mojo core wanted that name for a replacement module, I'd be happy to hand it back
10:29 good_news_everyon joined #mojo
10:29 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vHPtf
10:29 good_news_everyon mojo/master 0a8bb00 Sebastian Riedel: fix typo in Changes
10:29 good_news_everyon left #mojo
10:29 sri dunno
10:30 nic shall I stick with that and hand it back if you need it?
10:30 sri you know i like to keep the generic names
10:30 sri so of course i'm in favor of FileStore ;p
10:30 nic ahh
10:30 nic what would the full name be?
10:31 sri Mojo::Cookie::* is also kind of wrong, since you serialize the cookiejar content, no?
10:31 nic yeah
10:32 tyldis How to monkey_patch a helper? I static response for tests...
10:32 sri $t->app->helper(foo => sub {...})
10:32 nic sri: Mojo::UserAgent::CookieJar::FileStore ?
10:33 tyldis sri: Thnaks a bunch!
10:33 tyldis I overthinked again.
10:33 sri as long as no request has been made you can override helpers
10:33 tyldis Perfect
10:33 sri nic: seems reasonable
10:34 nic thanks
10:43 kiwiroy joined #mojo
10:56 dod joined #mojo
11:05 tencendur joined #mojo
11:35 stryx` joined #mojo
11:44 gregf_ joined #mojo
11:52 itaipu joined #mojo
12:03 aborazmeh joined #mojo
12:37 gizmomathboy joined #mojo
12:41 jberger CandyAngel will do. It's pretty far down on my todo stack rn tho
12:41 jberger If you wanted to take the guts there and run with it yourself I'd be fine with that
12:42 jberger Just a tip of the cap at the end would be enough
12:43 CandyAngel Hm.. tempting
12:44 CandyAngel Also, am I right in thinking that if my module connects to a server and sends the first message.. that's more ::UserAgent than ::IOLoop->client ?
12:44 jberger Probably yes
12:45 CandyAngel Because I'm trying to basically copy ::Server::Daemon, but that puts what it reads from remote as ::Transaction->req, even though it may be a response..
12:45 jberger ?
12:45 CandyAngel So it might be better to have a UserAgent-y thing, that just establishes a persistent connection..
12:46 CandyAngel I'm coding the client (e.g. browser) side of the connection, but I'm basing it on how Mojo::Server::Daemon works
12:47 ashimema joined #mojo
12:47 CandyAngel So my side sends the first packet, and the server responds
12:47 CandyAngel After the initial handshakey bit, it becomes a "either can send a message at any time"
12:47 jberger So it's probably better to mimic the ua of course, butt they are two sides of the same coin
12:48 jberger So it's like a websocket
12:48 CandyAngel Yeah, I'm hoping that when I come to code the server side of this, I can re-use the modules I've made for the client side
12:48 CandyAngel Yeah, I think so
12:49 jberger And as you see in the mojo code, most of the ws handling is very symmetric (and reused)
12:49 CandyAngel Yeah, exactly
12:49 CandyAngel I want that :P
12:49 jberger So moment of truth
12:50 jberger (And i don't know if you've ever engaged in this argument)
12:50 jberger But can you now see why we don't ship Mojolicious and Mojo::UserAgent separately?
12:51 CandyAngel Well, it's one of the good reasons why :P
12:53 nic that could be an exercise: how many files can you delete and still have the UA tests passing?  :)
12:53 CandyAngel All of them, if you delete the UA tests
12:53 nic \o/
12:53 CandyAngel UA tests run: 0 [SUCCESS]
12:54 nic My daughter seems to think I'm cheating if I say 1 is not a prime number :)
12:56 CandyAngel I mean.. you know how websockets have the handshake? I'm not sure if I should try and put the intial query/response bit in the same structure (as a handshake)
12:56 CandyAngel If that made any sense
12:57 nic it seems to make sense (without knowing any of the detail)
12:57 jberger nic if you define a prime (as most do) of Abby number that is only divisible by 1 and itself then 1 should be prime
12:57 jberger *any, thanks swipe!
12:58 nic jberger: that's the point
12:58 nic In maths we exclude the unhelpful cases
12:59 jberger But if you define the set of primes as a basis set which allows a unique decomposition of any number in its factors, then 1 cannot be in that set
13:00 CandyAngel I'm.. trying to keep my questions as related to Mojolicious as I can :P I can explain the protocol more if that's okay/wanted..
13:00 nic yes it can.  you forgot to exclude unbounded exponentiation :)
13:00 nic sorry CandyAngel, it was just an analogy
13:01 jberger CandyAngel isn't the websocket handshake already separated? It's an http message
13:01 CandyAngel Yeah
13:02 CandyAngel What I mean is, I'm considering if I should do the same thing with this protocol
13:03 CandyAngel After the client connects, it engages in a bit of query/response (to find out the server protocol and type, authenticate and the like) before the connection become... bi-directional?
13:03 CandyAngel This might be clearer if I knew the right terms to use
13:03 rshadow joined #mojo
13:03 CandyAngel So it's like: client query, server response, client query, server response, then "free for all"
13:06 aborazmeh joined #mojo
13:06 rshadow joined #mojo
13:06 maschine joined #mojo
13:07 ashimema_ joined #mojo
13:10 jberger but that initial protocol is only used for handshake?
13:10 ashimema joined #mojo
13:11 jberger in the ws case things are a bit different, it already implements HTTP and since the handshake is HTTP it needs a full parser system for it
13:11 jberger if yours is only used for handshake, I'd say roll something simple (and generally out of the way) and leave it at that
13:13 CandyAngel Hm, careful explaining time go
13:14 CandyAngel Data is sent as packets, where the leading byte is the size of the packet
13:15 CandyAngel Packets have types, and the way their data is laid out in the payload is packettype specific
13:15 nic CandyAngel: I'm wondering if there's any similarity with bson
13:16 nic Mango popped into my head, but I could be way off
13:16 nic sri: How do you feel about the name Mojo::CachingUserAgent (essentially a convenience subclass of Mojo::UserAgent)
13:17 nic I'm guessing core would never care about such a name
13:17 CandyAngel So like.. the packet for requesting properties is 0x03 0xFF 0x0A (0x03 is packet length, 0xFF is the object id to request properties from) and 0x0A is the packet type (property request)
13:17 sri nic: yea, core doesn't care
13:17 nic thanks
13:17 _Janos joined #mojo
13:21 CandyAngel I'm not sure if what I call packets here are the equivalent of a websocket frame or not
13:21 CandyAngel Can websockets frames have different "types"?
13:23 CandyAngel So frame1 is plaintext, frame2 is json, frame3 is plaintext, frame4 is binary (for example)
13:23 Armen good+morning
13:23 CandyAngel Heyas Armen
13:28 ashimema joined #mojo
13:32 sri CandyAngel: yes, there are different frame types
13:33 sri text, binary, continuation, ping, pong
13:33 sri close too
13:34 CandyAngel Okay, so I think the packets I get would map to websocket frames
13:34 CandyAngel So in this case, the handshake would be using "websocket frames" too
13:36 sri i would just always send json and make up my own meta data to put into the json
13:38 CandyAngel So instead of text/binary/ping frames, I'm sending propreq/sessinit/teleport frames :)
13:39 CandyAngel (and receiving them from the server)
13:39 CandyAngel sri: Do you know of any non-browser clients for the Mojolicious chat example?
13:39 nic I guess you would still need a broker/agent somewhere to translate between the legacy client language and the custom json (if using json in the transport)
13:40 CandyAngel I guess, in a way, the module I'm coding in the "broker/agent" doing this translation
13:41 nic yes
13:41 CandyAngel :)
13:41 CandyAngel coding is the*
13:42 nic following this path, the question is then: Is writing a low-level server that talks legacy easier to write/maintain than a high-level server that has a separate translator (broker)?
13:42 CandyAngel Hm
13:43 nic my instinct would be always go for the second option -- separation of concerns and all that -- and avoid the pain of maintaining a low-level server talking legacy :)
13:43 gryphon joined #mojo
13:44 CandyAngel So you think that I should have one bit that does the socket read/write and just translates it to, say JSON, and then just passes that somewhere else?
13:44 CandyAngel (and takes JSON and makes it into the legacy packets)
13:44 nic I think that gives more exciting possibilities (distributed solutions) for the future, yes
13:45 nic if we reach for buzz words: scalability, fault tolerance, load balancing  [even tho for this project you might not care about any of those]
13:46 nic (but as you know, I'm entirely ignorant of the detail, so have no real handle on which path is better)
13:49 Intern42 joined #mojo
14:11 _Janos joined #mojo
14:14 dod joined #mojo
14:34 CandyAngel Mhm, things worth thinking about though
15:02 cheako joined #mojo
15:07 CandyAngel My aim is to preserve use of the service
15:07 CandyAngel First by allowing new clients to be written (built on top of the work I'm doing now)
15:08 CandyAngel So they can be used with the official server
15:08 CandyAngel And a new server (also built on what I am doing now), which can be used with the official client
15:08 CandyAngel So.. I guess I am writing the broker at the moment
15:12 sri heh, allison randal is now also at suse
15:14 kgoess allison randal rocks
15:15 CandyAngel nic: Would you regard it as a broker if it handled handshakes and stuff internally?
15:16 CandyAngel Or only if it passes everything to the higher level?
15:26 tencendur joined #mojo
15:34 jhawley031 joined #mojo
15:41 go|dfish joined #mojo
15:46 PryMar56 joined #mojo
16:17 sh14 joined #mojo
16:21 disputin joined #mojo
16:21 disputin1 joined #mojo
16:49 cheako joined #mojo
16:55 cheako joined #mojo
16:57 Pyritic joined #mojo
17:20 itaipu joined #mojo
17:41 Intern42 joined #mojo
17:47 jstores0711 joined #mojo
17:59 rshadow joined #mojo
18:05 Pyritic joined #mojo
18:17 CandyAngel So I had a look at Mojo::UserAgent.. my Mojo::Service module is pretty much its equivalent
18:33 orev joined #mojo
18:34 Armen so... you reinvented a wheel?
18:44 CandyAngel No?
18:45 CandyAngel As far as I know, I can't use UA for this
18:45 CandyAngel It isn't HTTP or Websocket
18:46 Sumo joined #mojo
18:47 Sumo So, https://metacpan.org/source/SRI/Mojolicious-7.32/examples/chat.pl ->to_abs seems to know that it needs to be a ws / wss address, but when I use variables in the path-part it gets confused
18:48 cheako joined #mojo
18:52 irqq joined #mojo
18:58 jberger Sumo: url_for should handle that for you
19:08 Armen CandyAngel: ah, bummer... I love wheels!
19:08 Intern42 joined #mojo
19:09 Sumo jberger: I may be holding it wrong, but     under '/fancy/:id
19:10 Sumo under '/fancy/:id' => sub {} ; websocket 'sockets' => sub { ... }
19:11 jberger so if you do: url_for('sockets', id => $id)->to_abs
19:11 jberger does that work for you?
19:11 Sumo if I use url_for ('fancy/'. $thing . '/sockets' )->to_abs
19:11 Sumo i get an http url
19:11 jberger ah, ok
19:11 jberger so url_for can act in two modes
19:12 Sumo The 's' is right, i get https... but the ws is not.
19:12 jberger if you use it to build a Mojo::URL from a path-like string that's somewhat useful
19:12 jberger but if you use it to build a Mojo::URL from a route name, then you get extra benefits
19:12 Sumo Sure, if it starts with a /
19:14 Sumo There are 2 routes there, how do I name that?
19:14 jberger well first off, your path on the websocket route should start with a /
19:15 jberger but anyway, the route name for your websocket is 'socket' as shown there
19:15 jberger it generates a name from the path unless you give it another one
19:16 jberger if you run `./myapp.pl routes` it will show you all the routes with their names
19:16 jberger but you can also name it explicitly
19:16 dod joined #mojo
19:16 Sumo It sure does
19:16 jberger websocket '/socket' => sub { ... } => 'mysocket'
19:16 jberger it would be called mysocket
19:16 cheako joined #mojo
19:17 jberger protip, when you use `get '/' => 'mytemplate` what it really does is name the / route mytemplate and if there is nothing to render it tries to render a template of the same name as the route
19:17 Sumo var ws  = new WebSocket('<%= url_for(sockets => id => 92)->to_abs %>');
19:17 jberger yep, that should do it for you
19:18 Sumo naming the end route seems suspect
19:18 jberger now because you are creating the url from the route, the router knows that that is supposed to be a ws://
19:18 Sumo but i gues if it works
19:18 jberger why should naming the end route be suspect?
19:19 jberger (note also, when you put your application server behind a reverse proxy and set it up according to the cookbook, this will also automatically handle wss://)
19:20 Sumo As long as I set MOJO_GETS_PROXIED_INSTEAD_OF_IGNORING_HEADERS=true
19:21 jberger basically :-p
19:22 Sumo so, this websockets thingy, does morbo / hypnotoad do magic, or do I need an outside-of-mojo message bus make the chat example work cross-process?
19:23 pink_mist cross process you need an outside thingy
19:24 Sumo I guess Redis or Pg Pubsub...
19:26 sri https://metacpan.org/source/SRI/Mojo-Pg-3.06/examples/chat.pl
19:26 pink_mist yeah, iirc Mojo::Pg has a .. yeah that
19:27 Grinnz there's also https://metacpan.org/pod/distribution/Mercury/bin/mercury
19:28 Grinnz which acts as the broker process the same way, but uses websockets as the protocol
19:28 Sumo Now I have 2 problems, and both are websockets
19:28 Grinnz :)
19:31 CandyAngel Oh, is that what nic meant as a broker.. something like Mercury?
19:34 cheako joined #mojo
19:45 Grinnz maybe, but i'm missing the context
19:47 Sumo jberger: that under'ed websocket now completes a url, but it doesn't get as far as connecting :(
19:48 pink_mist Sumo: how are you running the app? and is it behind a frontend server of some sort?
19:48 jberger well if the url looks correct then you are on to a different problem
19:49 Sumo just on my computer
19:49 pink_mist that's not an answer
19:49 Sumo with perl example daemeon
19:49 Sumo It seems like $c->continue in the under ends in an endless wall of "routing to callback"
19:55 flyingninjamonkey99 joined #mojo
19:55 flyingninjamonkey99 left #mojo
19:56 flyingninjamonkey99 joined #mojo
20:01 flyingninjamonkey99 I am getting this same error for the majority of my variables in my program, please let me know if you have an idea because I have checked and I am pretty sure all my variables are initialized once in their scope. The error I get repetitively for nearly all my variables is : "my" variable $c masks earlier declaration in same scope at line 37, <DATA> line 2231.
20:02 Sumo !paste
20:02 Sumo idk if that's a thing
20:02 Grinnz flyingninjamonkey99: this can happen a lot when there's a syntax error, check the full error message to see if anything like that shows up in it
20:02 pink_mist flyingninjamonkey99: it might be you have a syntax error before the first of those errors
20:03 flyingninjamonkey99 Oh ok, thank you very much
20:04 Grinnz with syntax errors the perl parser can't be sure where the error specifically is, so it keeps going as much as it can, which usually ends up spitting out a lot of warnings along the way
20:28 Janos joined #mojo
20:37 Jonis joined #mojo
20:53 CandyAngel Are there any guide to when i should be using Mojo::IOLoop->singleton or Mojo::IOLoop->new?
20:53 CandyAngel guides*
20:55 Grinnz the only time to use a new ioloop rather than the singleton is when you want to run your own mini-loop within your callback
20:55 Grinnz like Mojo::UserAgent does for blocking requests, for example
20:55 CandyAngel Ah okay, perfect. Thankies
21:05 Jonis joined #mojo
21:31 Jonis joined #mojo
21:32 Jonis joined #mojo
21:42 sri hahahaha https://www.designernews.co/stories/84443-redditors-design-worst-volume-sliders-possible
21:43 preaction ... that first one...
21:44 cheako joined #mojo
21:45 CandyAngel Isn't that WMP?
21:45 Grinnz the joke of the curling one was "volume slider using cURL"
21:48 stryx` joined #mojo
21:52 xcodejoy joined #mojo
21:54 xcodejoy left #mojo
21:54 pink_mist https://imgur.com/gallery/YFRWwXQ
21:56 xcodejoy joined #mojo
21:56 xcodejoy left #mojo
21:56 xcodejoy joined #mojo
21:56 xcodejoy left #mojo
22:15 xcodejoy joined #mojo
22:15 xcodejoy left #mojo
22:35 stryx` joined #mojo
22:36 itaipu joined #mojo
22:46 karjala_ joined #mojo
22:47 disputin joined #mojo
22:48 disputin1 joined #mojo
23:12 trone joined #mojo
23:15 karjala_ left #mojo
23:21 tencendur joined #mojo
23:25 stryx` joined #mojo
23:58 tchaves joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary