-
Notifications
You must be signed in to change notification settings - Fork 483
Proposal: Socket Engine - Framework and Platform agnostic Angular Universal rendering. #1000
Comments
This is perfect! ECommerce are realy need this feature. |
@lionskape We're happy to hear why one might be better than the other. |
Hey @Toxicable thank you very much for this draft. After some thoughts this looks like a really interesting idea because all communication is done via TCP and no further language bindings are required to communicate with the renderer code (Like I did with J2V8 in my own solution). This allows a larger adoption, still Node.js is required (Maybe I just have to get rid of the idea to do it without Node.js at all). A few questions:
Btw: I try to keep things simple, so I prefer TCP over gRPC. But I can also implement a Java gRPC version if you are interested. Best, |
Right now there's no way to consume the libs. However you can just copy paste it into your app (note you'll need to copy paste Common Engine aswell.
The function returns a handler which you can call
This was a mistake on my part, the ls-routes is in a separate PR, I accidentally put it into the socket-engine one.
I havn't put any effort into cookies just yet, but that's definitely something we can add onto these new additions. Right now i'd just like to keep it simple and make sure it solves the problems that people have with Universal on other platforms.
It will really always be a requirement, sure other tools such as J2V8 allow you to get around it but simply using Nodejs is a much much simpler solution. |
What's the ETA on this? Will there be documentation/examples? |
@yanshuf0 It is our highest priority at the moment. Initially there will be a quick doc on how to get started just so we can get it out as fast as possible. |
When you ask for "when is it ready?" ask first "what could I do to make it quicker/better?" |
@dherges ok? |
@Toxicable So what is the status of the Java component of Universal? |
@inunotaisho26 Current status: |
Hey @Toxicable, if you don't mind could you please give an example on how could I use the suggested solution. Sorry, I'm an Android developer that just side track into front-end dev to create an ad-landing for our app, so a lot of this stuff is still very new to me. I got stuck at this step in the official tutorial as our backend is in Java/ Spring. I have a rough idea of putting the |
@vxhviet This is not ready yet, there is still work to be done before we can release this. |
Hello @Toxicable. I think it's really nice if we can pass some pre-fetched data to the TCP server to avoid additional API requests or passing user's selected locale (like we usually do |
@9you The TCP server will simply be running your application through |
Impressive. But it may be not necessary because to solve this problem you need just simple add You can help fix this issues and providers feature for socket-engine will be sooner. |
What do So what exactly do these parameters do? |
The id parameter is not used for rendering. It's used by the client to identify which request the content was rendered for. Since we're using bidirectional sockets here there's no request/response like with HTTP, therefore you need some identifier to figure out what response from the universal server correspondence to the request you just made |
@Toxicable so if I want to make a several request at the same session I must define a several id accordingly, is it correct? And what does the |
Hmm... Has anyone used something like https://github.com/zeit/pkg to package whole node + app with dependencies into one binary? Binary compile targets:
|
Hi, I want to know if there is a solution to get the cookies server side. How can I achieve this using this lib ? Thank you. |
really need this feature (or an implementation for Universal PHP) |
When will this be released? |
Hello can someone provide some example of how this should be used with php backend? |
Can the team please provide a tentative date for this release, that would help us wait on this if it isn't too far away from now. Thanks! |
@vinay-akkipet I'd hate to be negative but I think they are focusing on angular 9 and ivy |
@tayambamwanza Yes, we understand that. But Angular 9.0 (with full Ivy support) and 9.1 were already released |
@sergey-morenets Lol not at the time that I posted the comment, 13 January. |
|
@LayZeeDK That's fine. Do we already have socket-engine integration with Java/Spring Boot? |
I haven't tried out any of these releases, but if this proposal has been implemented as part of them, we just need to spin up the socket engine and connect to it through a TCP socket as described by OP. |
@Toxicable , Can you please explain the flow and high level logic of your implementation. I am new to Angular and as I can understand from the code, the agnostic platform (Python, Java, php etc) is creating a conection to port 9090 of Node API server passing the SocketEngineRenderOptions and is returning the SocketEngineResponse, which is the prerendered page to Angular which will then render it on the Browser. Is it right? |
Any update on this? Any chance of running SSR on a Java app/Tomcat server? :) |
@webchannel-idc A few years ago I wrote a Java implementation/proof of concept (See this thread). After solving so many issues (and seeing so many more open, unsolved ones) I would definitely recommend to use Node.js to host the frontend and to SSR there - not in Java. The developer experience (E.g. debugging) is so much better |
This issue is now obsolete due to changes in the recent releases. |
Hi @alan-agius4 Can you please specify that changes? |
The |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
While I personally think that having a separate NodeJS Express server for handling SSR is good solution it's not always possible to do so in every environment.
Therefore we can provide a simple and easily solution that enables Universal on any platform or framework.
Angular Socket Engine
Draft implementation: #999
Framework and Platform agnostic Angular Universal rendering.
Usage Server
npm install @nguniversal/socket-engine @nguniversal/common --save
This will the socket engine which internally hosts a TCP Socket server.
The default port is
9090
and host oflocalhost
You may want to leave this as a plain
.js
file since it is so simple and to make deploying it easier, but it can be easily transpiled from Typescript.Usage Client
Your client can be whatever language, framework or platform you like.
Aslong as it can connect to a TCP Socket (which all frameworks can) then you're good to go.
This example will use JS for simplicity
GRPC Engine
Draft implementation: #1003
Another proposed implementation thats very similar to the above Socket Engine, but instead of using a TCP Socket as the transport it uses GRPC.
This will make consuming it much easier since we can provide the .proto file and you're good to go.
Feel free to discuss advantages of both implementations.
The text was updated successfully, but these errors were encountered: